fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
namespace MyOffice.Data.Repositories.Account;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models.Accounts;
|
||||
using MyOffice.Data.Repositories;
|
||||
|
||||
@@ -24,4 +25,18 @@ public class AccountAccessInviteRepository : AppRepository<AccountAccessInvite>,
|
||||
{
|
||||
return UpdateBase(invite) > 0;
|
||||
}
|
||||
|
||||
public IEnumerable<AccountAccessInvite> GetActive(string email)
|
||||
{
|
||||
return _context
|
||||
.AccountAccessInvites
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.Email == email && !x.AcceptedOn.HasValue && !x.RejectedOn.HasValue);
|
||||
|
||||
}
|
||||
|
||||
public AccountAccessInvite? Get(Guid id)
|
||||
{
|
||||
return _context.AccountAccessInvites.FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,10 @@ using MyOffice.Data.Repositories;
|
||||
|
||||
public class AccountAccessRepository : AppRepository<AccountAccess>, IAccountAccessRepository
|
||||
{
|
||||
public bool Add(AccountAccess accountAccess)
|
||||
{
|
||||
return AddBase(accountAccess) > 0;
|
||||
}
|
||||
|
||||
public bool Update(AccountAccess accountAccess)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
public Account? Get(Guid userId, Guid id)
|
||||
{
|
||||
return _context.Accounts!
|
||||
.Include(x => x.Categories)!
|
||||
.Include(x => x.Categories!.Where(c => c.Category.UserId == userId))!
|
||||
.ThenInclude(x => x.Category)
|
||||
.Include(x => x.AccessRights)!
|
||||
.ThenInclude(x => x.User)
|
||||
|
||||
@@ -5,6 +5,8 @@ using Models.Accounts;
|
||||
public interface IAccountAccessInviteRepository
|
||||
{
|
||||
AccountAccessInvite? Get(Guid userId, string email);
|
||||
IEnumerable<AccountAccessInvite> GetActive(string email);
|
||||
AccountAccessInvite? Get(Guid id);
|
||||
bool Add(AccountAccessInvite invite);
|
||||
bool Update(AccountAccessInvite invite);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using Models.Accounts;
|
||||
|
||||
public interface IAccountAccessRepository
|
||||
{
|
||||
bool Add(AccountAccess accountAccess);
|
||||
bool Update(AccountAccess accountAccess);
|
||||
bool Delete(AccountAccess accountAccess);
|
||||
}
|
||||
Reference in New Issue
Block a user