using Email.Data.Entities;
using Email.Data.Repositories.Contracts;
using Microsoft.EntityFrameworkCore;

namespace Email.Data.Repositories;

public sealed class EfEmailTemplateRepository : IEmailTemplateRepository
{
    private readonly EmailDbContext _db;

    public EfEmailTemplateRepository(EmailDbContext db)
    {
        _db = db;
    }

    public async Task<IReadOnlyList<EmailTemplateEntity>> GetAllAsync(CancellationToken ct)
        => await _db.Templates.AsNoTracking().ToListAsync(ct);
}
