Files

87 lines
2.3 KiB
C#

using GozareshgirProgramManager.Domain.UserAgg.Entities;
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
public class UserRepository : RepositoryBase<long, User>, IUserRepository
{
private readonly ProgramManagerDbContext _context;
public UserRepository(ProgramManagerDbContext context) : base(context)
{
_context = context;
}
public Task<User?> GetByIdAsync(long id)
{
throw new NotImplementedException();
}
public async Task<User?> GetByGozareshgirAccountId(long accountId)
{
return await _context.Users.FirstOrDefaultAsync(x => x.AccountId == accountId);
}
public Task<User?> GetByEmailAsync(string email)
{
throw new NotImplementedException();
}
public Task<User?> GetByMobileAsync(string mobile)
{
throw new NotImplementedException();
}
public Task<IEnumerable<User>> GetAllAsync()
{
throw new NotImplementedException();
}
public Task<IEnumerable<User>> GetActiveUsersAsync()
{
throw new NotImplementedException();
}
public Task<User> AddAsync(User user)
{
throw new NotImplementedException();
}
public void Update(User user)
{
throw new NotImplementedException();
}
public void Delete(User user)
{
throw new NotImplementedException();
}
public Task<bool> ExistsAsync(long id)
{
throw new NotImplementedException();
}
public Task<bool> UsernameExistsAsync(string username)
{
throw new NotImplementedException();
}
public Task<bool> EmailExistsAsync(string email)
{
throw new NotImplementedException();
}
public Task<bool> MobileExistsAsync(string mobile)
{
throw new NotImplementedException();
}
public async Task<User?> GetUserWithRolesByIdAsync(long userId, CancellationToken cancellationToken)
{
return await _context.Users.Include(x => x.RoleUser)
.FirstOrDefaultAsync(x=>x.Id == userId, cancellationToken);
}
}