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

@@ -0,0 +1,64 @@
// ***********************************************************************
// <copyright file="IPermissionService.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 IPermissionProvider
{
/// <summary>
/// Creates a new Permission.
/// </summary>
/// <param name="entity">The Permission to be created.</param>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<PermissionAdapter> CreatePermission(PermissionRequest newPermission, CancellationToken cancellationToken);
/// <summary>
/// Gets an Permission by identifier.
/// </summary>
/// <param name="id">The Permission identifier.</param>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
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>
ValueTask<IEnumerable<PermissionAdapter>> GetAllPermissions(CancellationToken cancellationToken);
/// <summary>
/// Gets all the permissions by permissions identifier list.
/// </summary>
/// <param name="permissions">The list of permissions identifiers.</param>
/// <returns>A <see cref="Task{IEnumerable{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<IEnumerable<PermissionAdapter>> GetAllPermissionsByList(string[] permissions, CancellationToken cancellationToken);
/// <summary>
/// Changes the status of the permission.
/// </summary>
/// <param name="id">The permission identifier.</param>
/// <param name="newStatus">The new status of the permission.</param>
/// <returns>The <see cref="PermissionAdapter"/> updated entity.</returns>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<PermissionAdapter> ChangePermissionStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken);
/// <summary>
/// Updates a Permission by id.
/// </summary>
/// <param name="entity">The Permission to be updated.</param>
/// <param name="id">The Permission identifier.</param>
/// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<PermissionAdapter> UpdatePermission(PermissionAdapter entity, CancellationToken cancellationToken);
}
}