diff --git a/src/Core/API/API.Core/API.Core.csproj b/src/Core/API/API.Core/API.Core.csproj
index f033c7e..badce45 100644
--- a/src/Core/API/API.Core/API.Core.csproj
+++ b/src/Core/API/API.Core/API.Core.csproj
@@ -3,7 +3,7 @@
net10.0
enable
enable
- WebAPI
+ API.Core
Linux
@@ -11,16 +11,17 @@
-
+
-
+
+
-
+
.dockerignore
diff --git a/src/Core/API/API.Core/Controllers/AuthController.cs b/src/Core/API/API.Core/Controllers/AuthController.cs
index 7a0c82b..a0caf65 100644
--- a/src/Core/API/API.Core/Controllers/AuthController.cs
+++ b/src/Core/API/API.Core/Controllers/AuthController.cs
@@ -1,10 +1,9 @@
-using System.Net;
-using Repository.Core.Entities;
+using Domain.Core.Entities;
using Microsoft.AspNetCore.Mvc;
using Service.Core.Auth;
using Service.Core.Jwt;
-namespace WebAPI.Controllers
+namespace API.Core.Controllers
{
[ApiController]
[Route("api/[controller]")]
diff --git a/src/Core/API/API.Core/Controllers/NotFoundController.cs b/src/Core/API/API.Core/Controllers/NotFoundController.cs
index 52fb2aa..df2521c 100644
--- a/src/Core/API/API.Core/Controllers/NotFoundController.cs
+++ b/src/Core/API/API.Core/Controllers/NotFoundController.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;
-namespace WebAPI.Controllers
+namespace API.Core.Controllers
{
[ApiController]
[ApiExplorerSettings(IgnoreApi = true)]
diff --git a/src/Core/API/API.Core/Controllers/UserController.cs b/src/Core/API/API.Core/Controllers/UserController.cs
index f7760de..5077e44 100644
--- a/src/Core/API/API.Core/Controllers/UserController.cs
+++ b/src/Core/API/API.Core/Controllers/UserController.cs
@@ -1,8 +1,8 @@
-using Repository.Core.Entities;
+using Domain.Core.Entities;
using Microsoft.AspNetCore.Mvc;
using Service.Core.User;
-namespace WebAPI.Controllers
+namespace API.Core.Controllers
{
[ApiController]
[Route("api/[controller]")]
diff --git a/src/Core/Core.slnx b/src/Core/Core.slnx
index b2f3ee2..295ac8f 100644
--- a/src/Core/Core.slnx
+++ b/src/Core/Core.slnx
@@ -7,6 +7,10 @@
+
+
+
+
diff --git a/src/Core/Database/Database.Seed/Database.Seed.csproj b/src/Core/Database/Database.Seed/Database.Seed.csproj
index 4c68909..8d6121a 100644
--- a/src/Core/Database/Database.Seed/Database.Seed.csproj
+++ b/src/Core/Database/Database.Seed/Database.Seed.csproj
@@ -18,6 +18,7 @@
+
diff --git a/src/Core/Database/Database.Seed/UserSeeder.cs b/src/Core/Database/Database.Seed/UserSeeder.cs
index ead8905..13465b9 100644
--- a/src/Core/Database/Database.Seed/UserSeeder.cs
+++ b/src/Core/Database/Database.Seed/UserSeeder.cs
@@ -1,7 +1,7 @@
using System.Data;
using System.Security.Cryptography;
using System.Text;
-using Repository.Core.Entities;
+using Domain.Core.Entities;
using Repository.Core.Repositories;
using idunno.Password;
using Konscious.Security.Cryptography;
diff --git a/src/Core/Domain/Domain.Core/Domain.Core.csproj b/src/Core/Domain/Domain.Core/Domain.Core.csproj
new file mode 100644
index 0000000..00018cc
--- /dev/null
+++ b/src/Core/Domain/Domain.Core/Domain.Core.csproj
@@ -0,0 +1,8 @@
+
+
+ net10.0
+ enable
+ enable
+ Domain.Core
+
+
diff --git a/src/Core/Domain/Domain.Core/Entities/UserAccount.cs b/src/Core/Domain/Domain.Core/Entities/UserAccount.cs
new file mode 100644
index 0000000..4f10fdd
--- /dev/null
+++ b/src/Core/Domain/Domain.Core/Entities/UserAccount.cs
@@ -0,0 +1,14 @@
+namespace Domain.Core.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; }
+}
diff --git a/src/Core/Domain/Domain.Core/Entities/UserCredential.cs b/src/Core/Domain/Domain.Core/Entities/UserCredential.cs
new file mode 100644
index 0000000..1dd87f8
--- /dev/null
+++ b/src/Core/Domain/Domain.Core/Entities/UserCredential.cs
@@ -0,0 +1,11 @@
+namespace Domain.Core.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; }
+}
diff --git a/src/Core/Domain/Domain.Core/Entities/UserVerification.cs b/src/Core/Domain/Domain.Core/Entities/UserVerification.cs
new file mode 100644
index 0000000..777203c
--- /dev/null
+++ b/src/Core/Domain/Domain.Core/Entities/UserVerification.cs
@@ -0,0 +1,9 @@
+namespace Domain.Core.Entities;
+
+public class UserVerification
+{
+ public Guid UserVerificationId { get; set; }
+ public Guid UserAccountId { get; set; }
+ public DateTime VerificationDateTime { get; set; }
+ public byte[]? Timer { get; set; }
+}
diff --git a/src/Core/Domain/Domain.Validation/Domain.Validation.csproj b/src/Core/Domain/Domain.Validation/Domain.Validation.csproj
new file mode 100644
index 0000000..7ee98f4
--- /dev/null
+++ b/src/Core/Domain/Domain.Validation/Domain.Validation.csproj
@@ -0,0 +1,12 @@
+
+
+ net10.0
+ enable
+ enable
+ Domain.Validation
+
+
+
+
+
+
diff --git a/src/Core/Repository/Repository.Core/Entities/UserAccount.cs b/src/Core/Repository/Repository.Core/Entities/UserAccount.cs
deleted file mode 100644
index 0fea458..0000000
--- a/src/Core/Repository/Repository.Core/Entities/UserAccount.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace Repository.Core.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; }
-}
-
-
diff --git a/src/Core/Repository/Repository.Core/Entities/UserCredential.cs b/src/Core/Repository/Repository.Core/Entities/UserCredential.cs
deleted file mode 100644
index f2b44c9..0000000
--- a/src/Core/Repository/Repository.Core/Entities/UserCredential.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Repository.Core.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; }
-}
diff --git a/src/Core/Repository/Repository.Core/Entities/UserVerification.cs b/src/Core/Repository/Repository.Core/Entities/UserVerification.cs
deleted file mode 100644
index cc693bb..0000000
--- a/src/Core/Repository/Repository.Core/Entities/UserVerification.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Repository.Core.Entities;
-
-public class UserVerification
-{
- public Guid UserVerificationId { get; set; }
- public Guid UserAccountId { get; set; }
- public DateTime VerificationDateTime { get; set; }
- public byte[]? Timer { get; set; }
-}
diff --git a/src/Core/Repository/Repository.Core/Repositories/Auth/AuthRepository.cs b/src/Core/Repository/Repository.Core/Repositories/Auth/AuthRepository.cs
index e3a8495..efc3d8a 100644
--- a/src/Core/Repository/Repository.Core/Repositories/Auth/AuthRepository.cs
+++ b/src/Core/Repository/Repository.Core/Repositories/Auth/AuthRepository.cs
@@ -1,10 +1,11 @@
using System.Data;
using System.Data.Common;
+using Domain.Core.Entities;
using Repository.Core.Sql;
namespace Repository.Core.Repositories.Auth
{
- public class AuthRepository : Repository, IAuthRepository
+ public class AuthRepository : Repository, IAuthRepository
{
public AuthRepository(ISqlConnectionFactory connectionFactory)
: base(connectionFactory)
@@ -12,7 +13,7 @@ namespace Repository.Core.Repositories.Auth
}
- public async Task RegisterUserAsync(
+ public async Task RegisterUserAsync(
string username,
string firstName,
string lastName,
@@ -36,7 +37,7 @@ namespace Repository.Core.Repositories.Auth
var result = await command.ExecuteScalarAsync();
var userAccountId = result != null ? (Guid)result : Guid.Empty;
- return new Entities.UserAccount
+ return new Domain.Core.Entities.UserAccount
{
UserAccountId = userAccountId,
Username = username,
@@ -49,7 +50,7 @@ namespace Repository.Core.Repositories.Auth
}
- public async Task GetUserByEmailAsync(string email)
+ public async Task GetUserByEmailAsync(string email)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -63,7 +64,7 @@ namespace Repository.Core.Repositories.Auth
}
- public async Task GetUserByUsernameAsync(string username)
+ public async Task GetUserByUsernameAsync(string username)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -76,7 +77,7 @@ namespace Repository.Core.Repositories.Auth
return await reader.ReadAsync() ? MapToEntity(reader) : null;
}
- public async Task GetActiveCredentialByUserAccountIdAsync(Guid userAccountId)
+ public async Task GetActiveCredentialByUserAccountIdAsync(Guid userAccountId)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -105,9 +106,9 @@ namespace Repository.Core.Repositories.Auth
///
/// Maps a data reader row to a UserAccount entity.
///
- protected override Entities.UserAccount MapToEntity(DbDataReader reader)
+ protected override Domain.Core.Entities.UserAccount MapToEntity(DbDataReader reader)
{
- return new Entities.UserAccount
+ return new Domain.Core.Entities.UserAccount
{
UserAccountId = reader.GetGuid(reader.GetOrdinal("UserAccountId")),
Username = reader.GetString(reader.GetOrdinal("Username")),
@@ -128,9 +129,9 @@ namespace Repository.Core.Repositories.Auth
///
/// Maps a data reader row to a UserCredential entity.
///
- private static Entities.UserCredential MapToCredentialEntity(DbDataReader reader)
+ private static UserCredential MapToCredentialEntity(DbDataReader reader)
{
- var entity = new Entities.UserCredential
+ var entity = new UserCredential
{
UserCredentialId = reader.GetGuid(reader.GetOrdinal("UserCredentialId")),
UserAccountId = reader.GetGuid(reader.GetOrdinal("UserAccountId")),
diff --git a/src/Core/Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs b/src/Core/Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs
index df945a1..2f96e96 100644
--- a/src/Core/Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs
+++ b/src/Core/Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs
@@ -1,3 +1,5 @@
+using Domain.Core.Entities;
+
namespace Repository.Core.Repositories.Auth
{
///
@@ -16,7 +18,7 @@ namespace Repository.Core.Repositories.Auth
/// User's date of birth
/// Hashed password
/// The newly created UserAccount with generated ID
- Task RegisterUserAsync(
+ Task RegisterUserAsync(
string username,
string firstName,
string lastName,
@@ -30,7 +32,7 @@ namespace Repository.Core.Repositories.Auth
///
/// Email address to search for
/// UserAccount if found, null otherwise
- Task GetUserByEmailAsync(string email);
+ Task GetUserByEmailAsync(string email);
///
/// Retrieves a user account by username (typically used for login).
@@ -38,7 +40,7 @@ namespace Repository.Core.Repositories.Auth
///
/// Username to search for
/// UserAccount if found, null otherwise
- Task GetUserByUsernameAsync(string username);
+ Task GetUserByUsernameAsync(string username);
///
/// Retrieves the active (non-revoked) credential for a user account.
@@ -46,7 +48,7 @@ namespace Repository.Core.Repositories.Auth
///
/// ID of the user account
/// Active UserCredential if found, null otherwise
- Task GetActiveCredentialByUserAccountIdAsync(Guid userAccountId);
+ Task GetActiveCredentialByUserAccountIdAsync(Guid userAccountId);
///
/// Rotates a user's credential by invalidating all existing credentials and creating a new one.
diff --git a/src/Core/Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs b/src/Core/Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs
index 96bffba..d0bed2c 100644
--- a/src/Core/Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs
+++ b/src/Core/Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs
@@ -1,14 +1,15 @@
+using Domain.Core.Entities;
namespace Repository.Core.Repositories.UserAccount
{
public interface IUserAccountRepository
{
- Task GetByIdAsync(Guid id);
- Task> GetAllAsync(int? limit, int? offset);
- Task UpdateAsync(Entities.UserAccount userAccount);
+ Task GetByIdAsync(Guid id);
+ Task> GetAllAsync(int? limit, int? offset);
+ Task UpdateAsync(Domain.Core.Entities.UserAccount userAccount);
Task DeleteAsync(Guid id);
- Task GetByUsernameAsync(string username);
- Task GetByEmailAsync(string email);
+ Task GetByUsernameAsync(string username);
+ Task GetByEmailAsync(string email);
}
}
diff --git a/src/Core/Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs b/src/Core/Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs
index ccc5c63..548522b 100644
--- a/src/Core/Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs
+++ b/src/Core/Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs
@@ -1,13 +1,14 @@
using System.Data;
using System.Data.Common;
+using Domain.Core.Entities;
using Repository.Core.Sql;
namespace Repository.Core.Repositories.UserAccount
{
public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
- : Repository(connectionFactory), IUserAccountRepository
+ : Repository(connectionFactory), IUserAccountRepository
{
- public async Task GetByIdAsync(Guid id)
+ public async Task GetByIdAsync(Guid id)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -20,7 +21,7 @@ namespace Repository.Core.Repositories.UserAccount
return await reader.ReadAsync() ? MapToEntity(reader) : null;
}
- public async Task> GetAllAsync(int? limit, int? offset)
+ public async Task> GetAllAsync(int? limit, int? offset)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -34,7 +35,7 @@ namespace Repository.Core.Repositories.UserAccount
AddParameter(command, "@Offset", offset.Value);
await using var reader = await command.ExecuteReaderAsync();
- var users = new List();
+ var users = new List();
while (await reader.ReadAsync())
{
@@ -44,7 +45,7 @@ namespace Repository.Core.Repositories.UserAccount
return users;
}
- public async Task UpdateAsync(Entities.UserAccount userAccount)
+ public async Task UpdateAsync(Domain.Core.Entities.UserAccount userAccount)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -72,7 +73,7 @@ namespace Repository.Core.Repositories.UserAccount
await command.ExecuteNonQueryAsync();
}
- public async Task GetByUsernameAsync(string username)
+ public async Task GetByUsernameAsync(string username)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -85,7 +86,7 @@ namespace Repository.Core.Repositories.UserAccount
return await reader.ReadAsync() ? MapToEntity(reader) : null;
}
- public async Task GetByEmailAsync(string email)
+ public async Task GetByEmailAsync(string email)
{
await using var connection = await CreateConnection();
await using var command = connection.CreateCommand();
@@ -98,9 +99,9 @@ namespace Repository.Core.Repositories.UserAccount
return await reader.ReadAsync() ? MapToEntity(reader) : null;
}
- protected override Entities.UserAccount MapToEntity(DbDataReader reader)
+ protected override Domain.Core.Entities.UserAccount MapToEntity(DbDataReader reader)
{
- return new Entities.UserAccount
+ return new Domain.Core.Entities.UserAccount
{
UserAccountId = reader.GetGuid(reader.GetOrdinal("UserAccountId")),
Username = reader.GetString(reader.GetOrdinal("Username")),
diff --git a/src/Core/Repository/Repository.Core/Repository.Core.csproj b/src/Core/Repository/Repository.Core/Repository.Core.csproj
index 90cf6b9..5878edc 100644
--- a/src/Core/Repository/Repository.Core/Repository.Core.csproj
+++ b/src/Core/Repository/Repository.Core/Repository.Core.csproj
@@ -14,4 +14,7 @@
+
+
+
diff --git a/src/Core/Service/Service.Core/Auth/AuthService.cs b/src/Core/Service/Service.Core/Auth/AuthService.cs
index d939919..9d13629 100644
--- a/src/Core/Service/Service.Core/Auth/AuthService.cs
+++ b/src/Core/Service/Service.Core/Auth/AuthService.cs
@@ -1,4 +1,4 @@
-using Repository.Core.Entities;
+using Domain.Core.Entities;
using Repository.Core.Repositories.Auth;
using Service.Core.Password;
diff --git a/src/Core/Service/Service.Core/Auth/IAuthService.cs b/src/Core/Service/Service.Core/Auth/IAuthService.cs
index 45a4bd8..3e6e17c 100644
--- a/src/Core/Service/Service.Core/Auth/IAuthService.cs
+++ b/src/Core/Service/Service.Core/Auth/IAuthService.cs
@@ -1,4 +1,4 @@
-using Repository.Core.Entities;
+using Domain.Core.Entities;
namespace Service.Core.Auth;
@@ -6,4 +6,4 @@ public interface IAuthService
{
Task RegisterAsync(UserAccount userAccount, string password);
Task LoginAsync(string username, string password);
-}
\ No newline at end of file
+}
diff --git a/src/Core/Service/Service.Core/Service.Core.csproj b/src/Core/Service/Service.Core/Service.Core.csproj
index 5d8a635..988104d 100644
--- a/src/Core/Service/Service.Core/Service.Core.csproj
+++ b/src/Core/Service/Service.Core/Service.Core.csproj
@@ -11,6 +11,7 @@
+
diff --git a/src/Core/Service/Service.Core/User/IUserService.cs b/src/Core/Service/Service.Core/User/IUserService.cs
index ee256af..3bed122 100644
--- a/src/Core/Service/Service.Core/User/IUserService.cs
+++ b/src/Core/Service/Service.Core/User/IUserService.cs
@@ -1,4 +1,4 @@
-using Repository.Core.Entities;
+using Domain.Core.Entities;
namespace Service.Core.User;
@@ -8,4 +8,4 @@ public interface IUserService
Task GetByIdAsync(Guid id);
Task UpdateAsync(UserAccount userAccount);
-}
\ No newline at end of file
+}
diff --git a/src/Core/Service/Service.Core/User/UserService.cs b/src/Core/Service/Service.Core/User/UserService.cs
index cbb1423..fb249cd 100644
--- a/src/Core/Service/Service.Core/User/UserService.cs
+++ b/src/Core/Service/Service.Core/User/UserService.cs
@@ -1,4 +1,4 @@
-using Repository.Core.Entities;
+using Domain.Core.Entities;
using Repository.Core.Repositories.UserAccount;
namespace Service.Core.User;
@@ -19,4 +19,4 @@ public class UserService(IUserAccountRepository repository) : IUserService
{
await repository.UpdateAsync(userAccount);
}
-}
\ No newline at end of file
+}