137 lines
6.7 KiB
C#
137 lines
6.7 KiB
C#
// ***********************************************************************
|
|
// <copyright file="IUserService.cs">
|
|
// AgileWebs
|
|
// </copyright>
|
|
// ***********************************************************************
|
|
using Core.Blueprint.Mongo;
|
|
using Core.Thalos.Adapters;
|
|
using Core.Thalos.Domain.Contexts.Onboarding.Request;
|
|
|
|
namespace Core.Thalos.Provider.Contracts
|
|
{
|
|
public interface IUserProvider
|
|
{
|
|
/// <summary>
|
|
/// Creates a new User.
|
|
/// </summary>
|
|
/// <param name="entity">The User to be created.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter> CreateUser(UserRequest newUser, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Gets 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> GetUserById(string _id, CancellationToken cancellationToken);
|
|
|
|
|
|
/// <summary>
|
|
/// Gets all the users.
|
|
/// </summary>
|
|
/// <returns>A <see cref="{Task{IEnumerable{UserAdapter}}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<IEnumerable<UserAdapter>> GetAllUsers(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Gets an User by email.
|
|
/// </summary>
|
|
/// <param name="email">The User email.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter> GetUserByEmail(string? email, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Validates if a users exists by email.
|
|
/// </summary>
|
|
/// <param name="eamil">The User email.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter> ValidateUserExistence(string? email, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Changes the status of the user.
|
|
/// </summary>
|
|
/// <param name="id">The user identifier.</param>
|
|
/// <param name="newStatus">The new status of the user.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter> ChangeUserStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Updates a User by id.
|
|
/// </summary>
|
|
/// <param name="entity">The User to be updated.</param>
|
|
/// <param name="id">The User identifier.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter> UpdateUser(UserAdapter entity, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Logs in the user.
|
|
/// </summary>
|
|
/// <param name="email">The User's email.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter?> LogInUser(string email, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Logs out the user's session.
|
|
/// </summary>
|
|
/// <param name="email">The User's email.</param>
|
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
|
/// the asynchronous execution of the service.</returns>
|
|
ValueTask<UserAdapter?> LogOutUserSession(string email, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Adds a company to the user's list of companies.
|
|
/// </summary>
|
|
/// <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>
|
|
ValueTask<UserAdapter> AddCompanyToUser(string userId, string companyId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Removes a company from the user's list of companies.
|
|
/// </summary>
|
|
/// <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>
|
|
ValueTask<UserAdapter> RemoveCompanyFromUser(string userId, string companyId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Adds a project to the user's list of projects.
|
|
/// </summary>
|
|
/// <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>
|
|
ValueTask<UserAdapter> AddProjectToUser(string userId, string projectId, CancellationToken cancellationToken);
|
|
|
|
|
|
/// <summary>
|
|
/// Removes a project from the user's list of projects.
|
|
/// </summary>
|
|
/// <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>
|
|
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>
|
|
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);
|
|
}
|
|
}
|