Change the references and structure of the code to use Blueprint.Mongo package

This commit is contained in:
Oscar Morales
2025-05-19 14:12:00 -06:00
parent 24efe5612c
commit a36fd0e480
10 changed files with 565 additions and 829 deletions

View File

@@ -3,14 +3,13 @@
// AgileWebs
// </copyright>
// ***********************************************************************
using Core.Blueprint.Storage.Adapters;
using Core.Blueprint.Mongo;
using Core.Thalos.Adapters;
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.Domain.Contexts.Onboarding.Request;
namespace Core.Thalos.Provider.Contracts
{
public interface IUserService
public interface IUserProvider
{
/// <summary>
/// Creates a new User.
@@ -18,7 +17,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="entity">The User to be created.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> CreateUserService(UserRequest newUser);
ValueTask<UserAdapter> CreateUser(UserRequest newUser, CancellationToken cancellationToken);
/// <summary>
/// Gets an User by identifier.
@@ -26,7 +25,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="id">The User identifier.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> GetUserByIdService(string id);
ValueTask<UserAdapter> GetUserById(string _id, CancellationToken cancellationToken);
/// <summary>
@@ -34,7 +33,7 @@ namespace Core.Thalos.Provider.Contracts
/// </summary>
/// <returns>A <see cref="{Task{IEnumerable{UserAdapter}}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<IEnumerable<UserAdapter>> GetAllUsersService();
ValueTask<IEnumerable<UserAdapter>> GetAllUsers(CancellationToken cancellationToken);
/// <summary>
/// Gets an User by email.
@@ -42,7 +41,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="email">The User email.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> GetUserByEmailService(string? email);
ValueTask<UserAdapter> GetUserByEmail(string? email, CancellationToken cancellationToken);
/// <summary>
/// Validates if a users exists by email.
@@ -50,7 +49,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="eamil">The User email.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> ValidateUserExistenceService(string? email);
ValueTask<UserAdapter> ValidateUserExistence(string? email, CancellationToken cancellationToken);
/// <summary>
/// Changes the status of the user.
@@ -59,7 +58,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="newStatus">The new status of the user.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> ChangeUserStatusService(string id, StatusEnum newStatus);
ValueTask<UserAdapter> ChangeUserStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken);
/// <summary>
/// Updates a User by id.
@@ -68,7 +67,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="id">The User identifier.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> UpdateUserService(UserAdapter entity, string id);
ValueTask<UserAdapter> UpdateUser(UserAdapter entity, CancellationToken cancellationToken);
/// <summary>
/// Logs in the user.
@@ -76,7 +75,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="email">The User's email.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter?> LogInUserService(string email);
ValueTask<UserAdapter?> LogInUser(string email, CancellationToken cancellationToken);
/// <summary>
/// Logs out the user's session.
@@ -84,7 +83,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="email">The User's email.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<UserAdapter> LogOutUserSessionService(string email);
ValueTask<UserAdapter?> LogOutUserSession(string email, CancellationToken cancellationToken);
/// <summary>
/// Adds a company to the user's list of companies.
@@ -92,7 +91,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="userId">The identifier of the user to whom the company will be added.</param>
/// <param name="companyId">The identifier of the company to add.</param>
/// <returns>A <see cref="Task{UserAdapter}"/> representing the asynchronous operation, with the updated user object.</returns>
Task<UserAdapter> AddCompanyToUserService(string userId, string companyId);
ValueTask<UserAdapter> AddCompanyToUser(string userId, string companyId, CancellationToken cancellationToken);
/// <summary>
/// Removes a company from the user's list of companies.
@@ -100,7 +99,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="userId">The identifier of the user from whom the company will be removed.</param>
/// <param name="companyId">The identifier of the company to remove.</param>
/// <returns>A <see cref="Task{UserAdapter}"/> representing the asynchronous operation, with the updated user object.</returns>
Task<UserAdapter> RemoveCompanyFromUserService(string userId, string companyId);
ValueTask<UserAdapter> RemoveCompanyFromUser(string userId, string companyId, CancellationToken cancellationToken);
/// <summary>
/// Adds a project to the user's list of projects.
@@ -108,7 +107,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="userId">The identifier of the user to whom the project will be added.</param>
/// <param name="projectId">The identifier of the project to add.</param>
/// <returns>A <see cref="Task{UserAdapter}"/> representing the asynchronous operation, with the updated user object.</returns>
Task<UserAdapter> AddProjectToUserService(string userId, string projectId);
ValueTask<UserAdapter> AddProjectToUser(string userId, string projectId, CancellationToken cancellationToken);
/// <summary>
@@ -117,13 +116,21 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="userId">The identifier of the user from whom the project will be removed.</param>
/// <param name="projectId">The identifier of the project to remove.</param>
/// <returns>A <see cref="Task{UserAdapter}"/> representing the asynchronous operation, with the updated user object.</returns>
Task<UserAdapter> RemoveProjectFromUserService(string userId, string projectId);
ValueTask<UserAdapter> RemoveProjectFromUser(string userId, string projectId, CancellationToken cancellationToken);
/// <summary>
/// Gets the token adapter for a user.
/// </summary>
/// <param name="email">The user's email.</param>
/// <returns>A <see cref="{Task{TokenAdapter}}"/> representing the asynchronous execution of the service.</returns>
Task<TokenAdapter?> GetTokenAdapter(string email);
ValueTask<TokenAdapter?> GetToken(string email, CancellationToken cancellationToken);
/// <summary>
/// Delete an User by identifier.
/// </summary>
/// <param name="id">The User identifier.</param>
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<UserAdapter> DeleteUser(string _id, CancellationToken cancellationToken);
}
}