Refactor EmailTemplateDto and update command handler

The `EmailTemplateDto` class has been changed from a record with positional parameters to a class with explicit properties, including XML documentation and required modifiers for `Name`, `Body`, and `Subject`.

In the `ResetEnvelopeTemplateCommandHandler`, added necessary using directives, modified the constructor to accept an `IRepository<EmailTemplate>`, and updated the `Handle` method to read and update email templates based on the request's ID or type. The static `Default` collection has been renamed to `Defaults` and now uses `EmailTemplateDto`.
This commit is contained in:
Developer 02
2025-05-06 20:58:52 +02:00
parent 05de44bc13
commit 10341fd3cc
2 changed files with 52 additions and 13 deletions

View File

@@ -3,10 +3,30 @@ using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs
{
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record EmailTemplateDto(
int Id,
string Name,
string Body,
string Subject) : IUnique<int>;
public record EmailTemplateDto : IUnique<int>
{
/// <summary>
///
/// </summary>
public int Id{ get; init; }
/// <summary>
///
/// </summary>
public required string Name { get; init; }
/// <summary>
///
/// </summary>
public required string Body { get; init; }
/// <summary>
///
/// </summary>
public required string Subject { get; init; }
};
}