[CHANGE] Updated role repository tasks

This commit is contained in:
max
2025-04-11 19:57:20 +02:00
parent 0a5950cfa2
commit f0cb7218ac
3 changed files with 151 additions and 233 deletions

View File

@@ -1,19 +1,18 @@
using DotBased.AspNet.Authority.Models;
using DotBased.AspNet.Authority.Models.Authority;
using DotBased.Monads;
namespace DotBased.AspNet.Authority.Repositories;
public interface IRoleRepository
{
public Task<Result<QueryItems<AuthorityRoleItem>>> GetRolesAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default);
public Task<Result<AuthorityRole>> GetRoleByIdAsync(Guid id, CancellationToken cancellationToken = default);
public Task<Result<AuthorityRole>> CreateRoleAsync(AuthorityRole role, CancellationToken cancellationToken = default);
public Task<Result<AuthorityRole>> UpdateRoleAsync(AuthorityRole role, CancellationToken cancellationToken = default);
public Task<Result> DeleteRolesAsync(List<AuthorityRole> roles, CancellationToken cancellationToken = default);
public Task<Result> AddRolesLinkAsync(List<AuthorityRole> roles, Guid linkId, CancellationToken cancellationToken = default);
public Task<Result<List<AuthorityRole>>> GetLinkedRolesAsync(List<Guid> linkIds, CancellationToken cancellationToken = default);
public Task<Result> DeleteRolesLinkAsync(List<AuthorityRole> roles, Guid linkId, CancellationToken cancellationToken = default);
public Task<QueryItems<AuthorityRoleItem>> GetRolesAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default);
public Task<AuthorityRole?> GetRoleByIdAsync(Guid id, CancellationToken cancellationToken = default);
public Task<AuthorityRole?> CreateRoleAsync(AuthorityRole role, CancellationToken cancellationToken = default);
public Task<AuthorityRole?> UpdateRoleAsync(AuthorityRole role, CancellationToken cancellationToken = default);
public Task<bool> DeleteRolesAsync(List<AuthorityRole> roles, CancellationToken cancellationToken = default);
public Task<bool> AddRolesLinkAsync(List<AuthorityRole> roles, Guid linkId, CancellationToken cancellationToken = default);
public Task<List<AuthorityRole>> GetLinkedRolesAsync(List<Guid> linkIds, CancellationToken cancellationToken = default);
public Task<bool> UnlinkRolesAsync(List<AuthorityRole> roles, Guid linkId, CancellationToken cancellationToken = default);
/// <summary>
/// Return the role ids the linkId has.
@@ -22,5 +21,5 @@ public interface IRoleRepository
/// <param name="roles"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public Task<Result<List<Guid>>> HasRolesAsync(Guid linkId, List<AuthorityRole> roles, CancellationToken cancellationToken = default);
public Task<List<Guid>> GetRolesFromLinkAsync(Guid linkId, List<AuthorityRole> roles, CancellationToken cancellationToken = default);
}