using HrynCo.NotificationService.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.GetByService; internal sealed class GetEmailTemplatesHandler : RequestHandler>> { private readonly IEmailTemplateRepository _templates; public GetEmailTemplatesHandler( IContextualSerilogLogger logger, IUnitOfWork unitOfWork, IEmailTemplateRepository templates) : base(logger, unitOfWork) { _templates = templates; } protected override async Task>> DoOnHandle( GetEmailTemplatesQuery request, CancellationToken cancellationToken) { var templates = await _templates.GetByServiceAsync(request.ServiceName, cancellationToken); return Success(templates); } }