refactor: repUserId-Parameter zur ReadAllAsync-Methode in UserRepRepository hinzugefügt
This commit is contained in:
parent
4c02607409
commit
1273b7ac46
@ -7,6 +7,6 @@ namespace DigitalData.UserManager.Infrastructure.Contracts
|
||||
{
|
||||
Task<IEnumerable<UserRep>> ReadAllAsync(
|
||||
bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false,
|
||||
int? userId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true);
|
||||
int? userId = null, int? repUserId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true);
|
||||
}
|
||||
}
|
||||
@ -18,6 +18,7 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
_uRepRepo = userRepRepository;
|
||||
}
|
||||
|
||||
//TODO: instead of this implmenet .OnDelete(DeleteBehavior.ClientCascade) in DbContext
|
||||
public override async Task<bool> DeleteAsync(Group group)
|
||||
{
|
||||
var gou_list = await _gouRepo.ReadAsync(readOnly: false, groupId: group.Id);
|
||||
|
||||
@ -14,7 +14,7 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
|
||||
public async Task<IEnumerable<UserRep>> ReadAllAsync(
|
||||
bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false,
|
||||
int? userId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true)
|
||||
int? userId = null, int? repUserId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true)
|
||||
{
|
||||
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable();
|
||||
|
||||
@ -30,9 +30,12 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
if (withRepUser)
|
||||
query = query.Include(ur => ur.RepUser);
|
||||
|
||||
if(userId is not null)
|
||||
if (userId is not null)
|
||||
query = query.Where(ur => ur.UserId == userId);
|
||||
|
||||
if (repUserId is not null)
|
||||
query = query.Where(ur => ur.RepUserId == repUserId);
|
||||
|
||||
if (groupId is not null)
|
||||
query = query.Where(ur => ur.GroupId == groupId);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user