Developer 02 8b4ad5e28d Refactor email template commands and controller logic
- Updated namespace for `ResetEmailTemplateCommand` and added a constructor for flexible initialization.
- Introduced `ChangedWhen` property in `UpdateEmailTemplateCommand` to track modification time.
- Refactored `UpdateEmailTemplateCommandHandler` for improved email template retrieval logic.
- Modified `EmailTemplateController` method signatures and logic for clarity and consistency.
- Added `EmailTemplate` entry in `appsettings.json` for database trigger configuration.
2025-05-08 17:47:18 +02:00

30 lines
923 B
C#

using MediatR;
using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Update;
/// <summary>
/// Befehl zum Aktualisieren einer E-Mail-Vorlage.
/// </summary>
/// <param name="Body">
/// (Optional)Der neue Inhalt des E-Mail-Textkörpers. Wenn null, bleibt der vorhandene Inhalt unverändert.
/// </param>
/// <param name="Subject">
/// (Optional) Der neue Betreff der E-Mail. Wenn null, bleibt der vorhandene Betreff unverändert.
/// </param>
public record UpdateEmailTemplateCommand(string? Body = null, string? Subject = null) : IRequest
{
/// <param>
/// Die Abfrage, die die E-Mail-Vorlage darstellt, die aktualisiert werden soll.
/// </param>
[JsonIgnore]
public EmailTemplateQuery? EmailTemplateQuery { get; set; }
/// <summary>
///
/// </summary>
[JsonIgnore]
public DateTime ChangedWhen { get; init; } = DateTime.Now;
}