Use Blueprint.Mongo package in Role and Permission services

This commit is contained in:
Oscar Morales
2025-05-21 12:45:21 -06:00
parent c18c85959c
commit 1c38008e97
10 changed files with 403 additions and 666 deletions

View File

@@ -3,13 +3,13 @@
// AgileWebs
// </copyright>
// ***********************************************************************
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 IPermissionService
public interface IPermissionProvider
{
/// <summary>
/// Creates a new Permission.
@@ -17,7 +17,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="entity">The Permission to be created.</param>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<PermissionAdapter> CreatePermissionService(PermissionRequest newPermission);
ValueTask<PermissionAdapter> CreatePermission(PermissionRequest newPermission, CancellationToken cancellationToken);
/// <summary>
/// Gets an Permission by identifier.
@@ -25,14 +25,14 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="id">The Permission identifier.</param>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<PermissionAdapter> GetPermissionByIdService(string id);
ValueTask<PermissionAdapter> GetPermissionById(string _id, CancellationToken cancellationToken);
/// <summary>
/// Gets all the roles.
/// </summary>
/// <returns>A <see cref="{Task{IEnumerbale{PermissionAdapter}}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<IEnumerable<PermissionAdapter>> GetAllPermissionsService();
ValueTask<IEnumerable<PermissionAdapter>> GetAllPermissions(CancellationToken cancellationToken);
/// <summary>
/// Gets all the permissions by permissions identifier list.
@@ -40,7 +40,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="permissions">The list of permissions identifiers.</param>
/// <returns>A <see cref="Task{IEnumerable{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<IEnumerable<PermissionAdapter>> GetAllPermissionsByListService(string[] permissions);
ValueTask<IEnumerable<PermissionAdapter>> GetAllPermissionsByList(string[] permissions, CancellationToken cancellationToken);
/// <summary>
/// Changes the status of the permission.
@@ -50,7 +50,7 @@ namespace Core.Thalos.Provider.Contracts
/// <returns>The <see cref="PermissionAdapter"/> updated entity.</returns>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<PermissionAdapter> ChangePermissionStatusService(string id, StatusEnum newStatus);
ValueTask<PermissionAdapter> ChangePermissionStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken);
/// <summary>
/// Updates a Permission by id.
@@ -59,6 +59,6 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="id">The Permission identifier.</param>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<PermissionAdapter> UpdatePermissionService(PermissionAdapter entity, string id);
ValueTask<PermissionAdapter> UpdatePermission(PermissionAdapter entity, CancellationToken cancellationToken);
}
}

View File

@@ -9,7 +9,7 @@ using Core.Thalos.Domain.Contexts.Onboarding.Request;
namespace Core.Thalos.Provider.Contracts
{
public interface IRoleService
public interface IRoleProvider
{
/// <summary>
/// Creates a new Role.
@@ -17,7 +17,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="entity">The Role to be created.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<RoleAdapter> CreateRoleService(RoleRequest newRole);
ValueTask<RoleAdapter> CreateRole(RoleRequest newRole, CancellationToken cancellationToken);
/// <summary>
/// Gets an Role by identifier.
@@ -25,14 +25,14 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="id">The Role identifier.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<RoleAdapter> GetRoleByIdService(string id);
ValueTask<RoleAdapter> GetRoleById(string _id, CancellationToken cancellationToken);
/// <summary>
/// Gets all the roles.
/// </summary>
/// <returns>A <see cref="{Task{IEnumerbale{RoleAdapter}}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<IEnumerable<RoleAdapter>> GetAllRolesService();
ValueTask<IEnumerable<RoleAdapter>> GetAllRoles(CancellationToken cancellationToken);
/// <summary>
/// Changes the status of the role.
@@ -42,7 +42,7 @@ namespace Core.Thalos.Provider.Contracts
/// <returns>The <see cref="RoleAdapter"/> updated entity.</returns>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<RoleAdapter> ChangeRoleStatusService(string id, StatusEnum newStatus);
ValueTask<RoleAdapter> ChangeRoleStatus(string id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
/// <summary>
/// Updates a Role by id.
@@ -51,7 +51,7 @@ namespace Core.Thalos.Provider.Contracts
/// <param name="id">The Role identifier.</param>
/// <returns>A <see cref="{Task{RoleAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
Task<RoleAdapter> UpdateRoleService(RoleAdapter entity, string id);
ValueTask<RoleAdapter> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken);
/// <summary>
/// Adds an application to the role's list of applications.
@@ -59,7 +59,7 @@ namespace Core.Thalos.Provider.Contracts
/// <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>
Task<RoleAdapter> AddApplicationToRoleService(string roleId, ApplicationsEnum application);
ValueTask<RoleAdapter> AddApplicationToRole(string roleId, ApplicationsEnum application, CancellationToken cancellationToken);
/// <summary>
/// Removes an application from the role's list of applications.
@@ -67,6 +67,6 @@ namespace Core.Thalos.Provider.Contracts
/// <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>
Task<RoleAdapter> RemoveApplicationFromRoleService(string roleId, ApplicationsEnum application);
ValueTask<RoleAdapter> RemoveApplicationFromRole(string roleId, ApplicationsEnum application, CancellationToken cancellationToken);
}
}