mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-04-06 02:19:05 +00:00
Feature: Add token validation, basic confirmation workflow (#164)
This commit is contained in:
8
src/Core/Domain/Domain.Entities/Domain.Entities.csproj
Normal file
8
src/Core/Domain/Domain.Entities/Domain.Entities.csproj
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>Domain</RootNamespace>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
14
src/Core/Domain/Domain.Entities/Entities/UserAccount.cs
Normal file
14
src/Core/Domain/Domain.Entities/Entities/UserAccount.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserAccount
|
||||
{
|
||||
public Guid UserAccountId { get; set; }
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public DateTime DateOfBirth { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
}
|
||||
11
src/Core/Domain/Domain.Entities/Entities/UserCredential.cs
Normal file
11
src/Core/Domain/Domain.Entities/Entities/UserCredential.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserCredential
|
||||
{
|
||||
public Guid UserCredentialId { get; set; }
|
||||
public Guid UserAccountId { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime Expiry { get; set; }
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
public byte[]? Timer { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserVerification
|
||||
{
|
||||
public Guid UserVerificationId { get; set; }
|
||||
public Guid UserAccountId { get; set; }
|
||||
public DateTime VerificationDateTime { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
33
src/Core/Domain/Domain.Exceptions/Exceptions.cs
Normal file
33
src/Core/Domain/Domain.Exceptions/Exceptions.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace Domain.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when a resource conflict occurs (e.g., duplicate username, email already in use).
|
||||
/// Maps to HTTP 409 Conflict.
|
||||
/// </summary>
|
||||
public class ConflictException(string message) : Exception(message);
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when a requested resource is not found.
|
||||
/// Maps to HTTP 404 Not Found.
|
||||
/// </summary>
|
||||
public class NotFoundException(string message) : Exception(message);
|
||||
|
||||
// Domain.Exceptions/UnauthorizedException.cs
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when authentication fails or is required.
|
||||
/// Maps to HTTP 401 Unauthorized.
|
||||
/// </summary>
|
||||
public class UnauthorizedException(string message) : Exception(message);
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when a user is authenticated but lacks permission to access a resource.
|
||||
/// Maps to HTTP 403 Forbidden.
|
||||
/// </summary>
|
||||
public class ForbiddenException(string message) : Exception(message);
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when business rule validation fails (distinct from FluentValidation).
|
||||
/// Maps to HTTP 400 Bad Request.
|
||||
/// </summary>
|
||||
public class ValidationException(string message) : Exception(message);
|
||||
Reference in New Issue
Block a user