[CHANGE] Moved repositories to new monads
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
using DotBased.AspNet.Authority.Models.Authority;
|
||||
using DotBased.Monads;
|
||||
|
||||
namespace DotBased.AspNet.Authority.Managers;
|
||||
|
||||
public partial class AuthorityManager
|
||||
{
|
||||
public async Task<ListResultOld<AuthorityGroup>> GetUserGroupsAsync(AuthorityUser user, CancellationToken cancellationToken = default)
|
||||
public async Task<Result<List<AuthorityGroup>>> GetUserGroupsAsync(AuthorityUser user, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GroupRepository.GetUserGroupsAsync(user, cancellationToken);
|
||||
try
|
||||
{
|
||||
return await GroupRepository.GetUserGroupsAsync(user, cancellationToken);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
@@ -109,9 +109,9 @@ public partial class AuthorityManager
|
||||
var searchIds = new List<Guid> { user.Id };
|
||||
|
||||
var usrGroups = await GetUserGroupsAsync(user, cancellationToken);
|
||||
if (usrGroups.Success)
|
||||
if (usrGroups.IsSuccess)
|
||||
{
|
||||
searchIds.AddRange(usrGroups.Items.Select(g => g.Id).ToList());
|
||||
searchIds.AddRange(usrGroups.Value.Select(g => g.Id).ToList());
|
||||
}
|
||||
|
||||
var linkedRolesResult = await RoleRepository.GetLinkedRolesAsync(searchIds, cancellationToken);
|
||||
|
@@ -1,12 +1,13 @@
|
||||
using DotBased.AspNet.Authority.Models;
|
||||
using DotBased.AspNet.Authority.Models.Authority;
|
||||
|
||||
namespace DotBased.AspNet.Authority.Repositories;
|
||||
|
||||
public interface IAttributeRepository
|
||||
{
|
||||
public Task<ListResultOld<AuthorityAttributeItem>> GetAttributesAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld<AuthorityAttribute>> GetAttributeByKeyAsync(string id, CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld<AuthorityAttribute>> CreateAttributeAsync(AuthorityAttribute attribute, CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld<AuthorityAttribute>> UpdateAttributeAsync(AuthorityAttribute attribute, CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld> DeleteAttributeAsync(AuthorityAttribute attribute, CancellationToken cancellationToken = default);
|
||||
public Task<QueryItems<AuthorityAttributeItem>> GetAttributesAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default);
|
||||
public Task<AuthorityAttribute?> GetAttributeByKeyAsync(string id, CancellationToken cancellationToken = default);
|
||||
public Task<AuthorityAttribute?> CreateAttributeAsync(AuthorityAttribute attribute, CancellationToken cancellationToken = default);
|
||||
public Task<AuthorityAttribute?> UpdateAttributeAsync(AuthorityAttribute attribute, CancellationToken cancellationToken = default);
|
||||
public Task<bool> DeleteAttributeAsync(AuthorityAttribute attribute, CancellationToken cancellationToken = default);
|
||||
}
|
@@ -1,13 +1,14 @@
|
||||
using DotBased.AspNet.Authority.Models;
|
||||
using DotBased.AspNet.Authority.Models.Authority;
|
||||
|
||||
namespace DotBased.AspNet.Authority.Repositories;
|
||||
|
||||
public interface IGroupRepository
|
||||
{
|
||||
public Task<ListResultOld<AuthorityGroupItem>> GetGroupsAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld<AuthorityGroup>> GetGroupByIdAsync(string id, CancellationToken cancellationToken = default);
|
||||
public Task<ListResultOld<AuthorityGroup>> GetUserGroupsAsync(AuthorityUser user, CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld<AuthorityGroup>> CreateGroupAsync(AuthorityGroup group, CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld<AuthorityGroup>> UpdateGroupAsync(AuthorityGroup group, CancellationToken cancellationToken = default);
|
||||
public Task<ResultOld> DeleteGroupAsync(AuthorityGroup group, CancellationToken cancellationToken = default);
|
||||
public Task<QueryItems<AuthorityGroupItem>> GetGroupsAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default);
|
||||
public Task<AuthorityGroup?> GetGroupByIdAsync(string id, CancellationToken cancellationToken = default);
|
||||
public Task<List<AuthorityGroup>> GetUserGroupsAsync(AuthorityUser user, CancellationToken cancellationToken = default);
|
||||
public Task<AuthorityGroup?> CreateGroupAsync(AuthorityGroup group, CancellationToken cancellationToken = default);
|
||||
public Task<AuthorityGroup?> UpdateGroupAsync(AuthorityGroup group, CancellationToken cancellationToken = default);
|
||||
public Task<bool> DeleteGroupAsync(AuthorityGroup group, CancellationToken cancellationToken = default);
|
||||
}
|
Reference in New Issue
Block a user