Add tenant services

This commit is contained in:
2025-08-03 15:19:16 -06:00
parent 7c92a7e791
commit 0eadd6e217
18 changed files with 1134 additions and 514 deletions

View File

@@ -3,69 +3,97 @@
// AgileWebs
// </copyright>
// ***********************************************************************
using Core.Thalos.BuildingBlocks;
using Core.Thalos.Domain.Contexts.Onboarding.Request;
namespace Core.Thalos.Provider.Contracts
{
/// <summary>
/// Interface for Role-related service operations.
/// </summary>
public interface IRoleProvider
{
/// <summary>
/// Creates a new Role.
/// </summary>
/// <param name="entity">The Role to be created.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
/// <param name="newRole">The Role to be created.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
/// </returns>
ValueTask<RoleAdapter> CreateRole(RoleRequest newRole, CancellationToken cancellationToken);
/// <summary>
/// Gets an Role by identifier.
/// Gets a Role by its identifier.
/// </summary>
/// <param name="id">The Role identifier.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
/// <param name="_id">The Role Mongo identifier.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
/// </returns>
ValueTask<RoleAdapter> GetRoleById(string _id, CancellationToken cancellationToken);
/// <summary>
/// Gets all the roles.
/// Gets all Roles.
/// </summary>
/// <returns>A <see cref="{Task{IEnumerbale{RoleAdapter}}}"/> representing
/// the asynchronous execution of the service.</returns>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{IEnumerable{RoleAdapter}}"/> representing the asynchronous execution of the service.
/// </returns>
ValueTask<IEnumerable<RoleAdapter>> GetAllRoles(CancellationToken cancellationToken);
/// <summary>
/// Changes the status of the role.
/// Changes the status of a Role.
/// </summary>
/// <param name="id">The role identifier.</param>
/// <param name="newStatus">The new status of the role.</param>
/// <returns>The <see cref="RoleAdapter"/> updated entity.</returns>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<RoleAdapter> ChangeRoleStatus(string id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
/// <param name="_id">The Role Mongo identifier.</param>
/// <param name="newStatus">The new status of the Role.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
/// </returns>
ValueTask<RoleAdapter> ChangeRoleStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
/// <summary>
/// Updates a Role by id.
/// Updates a Role.
/// </summary>
/// <param name="entity">The Role to be updated.</param>
/// <param name="id">The Role identifier.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
/// </returns>
ValueTask<RoleAdapter> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken);
/// <summary>
/// Adds an application to the role's list of applications.
/// Adds an application to the Role's list of applications.
/// </summary>
/// <param name="roleId">The identifier of the role to which the application will be added.</param>
/// <param name="roleId">The identifier of the Role to which the application will be added.</param>
/// <param name="application">The application enum value to add.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing the asynchronous operation, with the updated role object.</returns>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous operation with the updated Role.
/// </returns>
ValueTask<RoleAdapter> AddApplicationToRole(string roleId, ApplicationsEnum application, CancellationToken cancellationToken);
/// <summary>
/// Removes an application from the role's list of applications.
/// Removes an application from the Role's list of applications.
/// </summary>
/// <param name="roleId">The identifier of the role from which the application will be removed.</param>
/// <param name="roleId">The identifier of the Role from which the application will be removed.</param>
/// <param name="application">The application enum value to remove.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing the asynchronous operation, with the updated role object.</returns>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous operation with the updated Role.
/// </returns>
ValueTask<RoleAdapter> RemoveApplicationFromRole(string roleId, ApplicationsEnum application, CancellationToken cancellationToken);
/// <summary>
/// Deletes a Role by its identifier.
/// </summary>
/// <param name="_id">The Role Mongo identifier.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
/// </returns>
ValueTask<RoleAdapter?> DeleteRole(string _id, CancellationToken cancellationToken);
}
}