Files
FACULTATE-HEALTHCARE_MANAGER/backend/Infrastructure/Services/PostgreSQL/PatientRepository.cs
T
2024-05-21 12:10:53 +03:00

19 lines
704 B
C#

using Application.Services.Database.PostgreSQL;
using Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace Infrastructure.Services.PostgreSQL;
public class PatientRepository(HealthcareManagerDatabase context)
: BasePostgreSqlRepository<Patient>(context), IPatientRepository
{
public async Task<Patient?> FindByEmailAsync(string email, CancellationToken token)
{
return await Context.Patients.FirstOrDefaultAsync(d => d.Email == email, token);
}
public async Task<bool> CredentialsMatch(string email, string password, CancellationToken token)
{
return await Context.Patients.AnyAsync(u => u.Email == email && u.Password == password, token);
}
}