fix
This commit is contained in:
@@ -21,11 +21,15 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
{
|
||||
return _context.Accounts!
|
||||
.Include(x => x.CurrencyGlobal)
|
||||
.Include(x => x.Categories!.Where(x => x.Category.UserId == userId))!
|
||||
// categories created with current user
|
||||
.Include(x => x.Categories!.Where(c => c.Category.UserId == userId))!
|
||||
.ThenInclude(x => x.Category)
|
||||
.Include(x => x.AccessRights)!
|
||||
// access rights created with current user
|
||||
.Include(x => x.AccessRights!.Where(a => a.OwnerId == userId))!
|
||||
.ThenInclude(x => x.User)
|
||||
.Include(x => x.Motions)!
|
||||
// require only one motions to check if can to delete account
|
||||
.Include(x => x.Motions!.Take(1))!
|
||||
// only accounts with access to current user
|
||||
.Where(x => x.AccessRights!.Any(a => a.UserId == userId))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user