diff --git a/src/Imprink.Application/Imprink.Application.csproj b/src/Imprink.Application/Imprink.Application.csproj index 892e1ef..d0d26c3 100644 --- a/src/Imprink.Application/Imprink.Application.csproj +++ b/src/Imprink.Application/Imprink.Application.csproj @@ -21,6 +21,7 @@ + diff --git a/src/Imprink.Domain/Repositories/IRoleRepository.cs b/src/Imprink.Domain/Repositories/IRoleRepository.cs new file mode 100644 index 0000000..f92043c --- /dev/null +++ b/src/Imprink.Domain/Repositories/IRoleRepository.cs @@ -0,0 +1,11 @@ +using Imprink.Domain.Entities.Users; + +namespace Imprink.Domain.Repositories; + +public interface IRoleRepository +{ + Task> GetAllRolesAsync(CancellationToken cancellationToken = default); + Task GetRoleByIdAsync(Guid roleId, CancellationToken cancellationToken = default); + Task GetRoleByNameAsync(string roleName, CancellationToken cancellationToken = default); + Task RoleExistsAsync(Guid roleId, CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/src/Imprink.Domain/Repositories/IUserRepository.cs b/src/Imprink.Domain/Repositories/IUserRepository.cs new file mode 100644 index 0000000..145583d --- /dev/null +++ b/src/Imprink.Domain/Repositories/IUserRepository.cs @@ -0,0 +1,36 @@ +using Imprink.Domain.Entities.Users; + +namespace Imprink.Domain.Repositories; + +public interface IUserRepository +{ + Task GetUserByIdAsync(string userId, CancellationToken cancellationToken = default); + Task GetUserByEmailAsync(string email, CancellationToken cancellationToken = default); + Task> GetAllUsersAsync(CancellationToken cancellationToken = default); + Task> GetActiveUsersAsync(CancellationToken cancellationToken = default); + + Task CreateUserAsync(User user, CancellationToken cancellationToken = default); + Task UpdateUserAsync(User user, CancellationToken cancellationToken = default); + Task DeleteUserAsync(string userId, CancellationToken cancellationToken = default); + + Task UserExistsAsync(string userId, CancellationToken cancellationToken = default); + Task EmailExistsAsync(string email, CancellationToken cancellationToken = default); + + Task ActivateUserAsync(string userId, CancellationToken cancellationToken = default); + Task DeactivateUserAsync(string userId, CancellationToken cancellationToken = default); + Task UpdateLastLoginAsync(string userId, DateTime loginTime, CancellationToken cancellationToken = default); + + Task> SearchUsersAsync(string searchTerm, CancellationToken cancellationToken = default); + Task> GetUsersByRoleAsync(Guid roleId, CancellationToken cancellationToken = default); + + Task<(IEnumerable Users, int TotalCount)> GetUsersPagedAsync( + int pageNumber, + int pageSize, + string? searchTerm = null, + bool? isActive = null, + CancellationToken cancellationToken = default); + + Task GetUserWithAddressesAsync(string userId, CancellationToken cancellationToken = default); + Task GetUserWithRolesAsync(string userId, CancellationToken cancellationToken = default); + Task GetUserWithAllRelatedDataAsync(string userId, CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/src/Imprink.Domain/Repositories/IUserRoleRepository.cs b/src/Imprink.Domain/Repositories/IUserRoleRepository.cs new file mode 100644 index 0000000..b60441a --- /dev/null +++ b/src/Imprink.Domain/Repositories/IUserRoleRepository.cs @@ -0,0 +1,15 @@ +using Imprink.Domain.Entities.Users; + +namespace Imprink.Domain.Repositories; + +public interface IUserRoleRepository +{ + Task> GetUserRolesAsync(string userId, CancellationToken cancellationToken = default); + Task> GetUsersInRoleAsync(Guid roleId, CancellationToken cancellationToken = default); + Task IsUserInRoleAsync(string userId, Guid roleId, CancellationToken cancellationToken = default); + + Task GetUserRoleAsync(string userId, Guid roleId, CancellationToken cancellationToken = default); + Task AddUserRoleAsync(UserRole userRole, CancellationToken cancellationToken = default); + Task RemoveUserRoleAsync(UserRole userRole, CancellationToken cancellationToken = default); + Task> GetUserRolesByUserIdAsync(string userId, CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/src/Imprink.WebApi/Controllers/CategoriesController.cs b/src/Imprink.WebApi/Controllers/Products/CategoriesController.cs similarity index 100% rename from src/Imprink.WebApi/Controllers/CategoriesController.cs rename to src/Imprink.WebApi/Controllers/Products/CategoriesController.cs diff --git a/src/Imprink.WebApi/Controllers/ProductVariantsController.cs b/src/Imprink.WebApi/Controllers/Products/ProductVariantsController.cs similarity index 100% rename from src/Imprink.WebApi/Controllers/ProductVariantsController.cs rename to src/Imprink.WebApi/Controllers/Products/ProductVariantsController.cs diff --git a/src/Imprink.WebApi/Controllers/ProductsController.cs b/src/Imprink.WebApi/Controllers/Products/ProductsController.cs similarity index 100% rename from src/Imprink.WebApi/Controllers/ProductsController.cs rename to src/Imprink.WebApi/Controllers/Products/ProductsController.cs diff --git a/src/Imprink.WebApi/Imprink.WebApi.csproj b/src/Imprink.WebApi/Imprink.WebApi.csproj index 62a158e..74587f2 100644 --- a/src/Imprink.WebApi/Imprink.WebApi.csproj +++ b/src/Imprink.WebApi/Imprink.WebApi.csproj @@ -29,4 +29,9 @@ + + + + +