using Application.Services.Database;
using Core.Entities;
using Infrastructure.Data;
using Microsoft.EntityFrameworkCore;

namespace Infrastructure.Services.PostgreSQL;

public class MedicalHistoryRepository : BasePostgreSQLRepository<MedicalHistory>, IMedicalHistoryRepository
{
    public MedicalHistoryRepository(HealthcareManagerDatabase context) : base(context)
    {
    }

    public async Task<MedicalHistory?> GetByUserIdAsync(Guid userId)
    {
        return await _context.MedicalHistories.FirstOrDefaultAsync(d => d.UserId == userId);
    }
}