using HrynCo.DAL.Abstract; using HrynCo.NotificationService.DAL.Abstract.Repositories; using HrynCo.NotificationService.DAL.Abstract.Templates; using HrynCo.NotificationService.Services.Core; using HrynCo.NotificationService.Services.Logging; using static HrynCo.NotificationService.Services.Core.ServiceResultHelper; namespace HrynCo.NotificationService.Services.EmailTemplates.GetAll; internal sealed class GetAllEmailTemplatesHandler : RequestHandler>> { private readonly IEmailTemplateRepository _templates; public GetAllEmailTemplatesHandler( IContextualSerilogLogger logger, IUnitOfWork unitOfWork, IEmailTemplateRepository templates) : base(logger, unitOfWork) { _templates = templates; } protected override async Task>> DoOnHandle( GetAllEmailTemplatesQuery request, CancellationToken cancellationToken) { var templates = await _templates.GetAllAsync(cancellationToken); return Success(templates); } }