Refactor email template command and handler

Introduced `ResetEmailTemplateCommand` and `ResetEmailTemplateCommandHandler`, replacing the previous `ResetEnvelopeTemplateCommand` and its handler. Updated the controller to utilize the new command, ensuring consistent mapping and command sending.
This commit is contained in:
Developer 02
2025-05-07 16:07:43 +02:00
parent 519df50404
commit b15616cf53
3 changed files with 7 additions and 7 deletions

View File

@@ -20,4 +20,4 @@ namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
/// 8 - DocumentRejected_REC (Für den ablehnenden Empfänger): Mail an den ablehnenden Empfänger, wenn das Dokument abgelehnt wird.
/// 9 - DocumentRejected_REC_2 (Für sonstige Empfänger): Mail an andere Empfänger (Brief), wenn das Dokument abgelehnt wird.
/// </param>
public record ResetEnvelopeTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : EmailTemplateQuery(Id, Type), IRequest;
public record ResetEmailTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : EmailTemplateQuery(Id, Type), IRequest;

View File

@@ -9,7 +9,7 @@ namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
/// <summary>
///
/// </summary>
public class ResetEnvelopeTemplateCommandHandler : IRequestHandler<ResetEnvelopeTemplateCommand>
public class ResetEmailTemplateCommandHandler : IRequestHandler<ResetEmailTemplateCommand>
{
private readonly IRepository<EmailTemplate> _repository;
@@ -17,12 +17,12 @@ public class ResetEnvelopeTemplateCommandHandler : IRequestHandler<ResetEnvelope
///
/// </summary>
/// <param name="repository"></param>
public ResetEnvelopeTemplateCommandHandler(IRepository<EmailTemplate> repository)
public ResetEmailTemplateCommandHandler(IRepository<EmailTemplate> repository)
{
_repository = repository;
}
public async Task Handle(ResetEnvelopeTemplateCommand request, CancellationToken cancel)
public async Task Handle(ResetEmailTemplateCommand request, CancellationToken cancel)
{
var temps = request.Id is not null
? await _repository.ReadAllAsync<EmailTemplateDto>(t => t.Id == request.Id, cancel)