Refactor email template commands and add controller

- Updated `UpdateEmailTemplateCommand` to use a property for `EmailTemplateQuery` with `JsonIgnore`, allowing optional body and subject parameters.
- Simplified `UpdateToDefaultCommand` by removing documentation comments and constructor parameters.
- Corrected namespace for `ReadEmailTemplateQuery` from `Query.Read` to `Queries.Read`.
- Introduced `ResetEnvelopeTemplateCommand` with optional ID and type, inheriting from `EmailTemplateQuery`, along with detailed XML documentation.
- Added `EmailTemplateController` to manage email templates, including methods for retrieval and updates, utilizing AutoMapper and authorization attributes.
This commit is contained in:
Developer 02
2025-04-12 01:20:04 +02:00
parent f17820e011
commit fe252b9979
4 changed files with 105 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.UpdateToDefault;
using EnvelopeGenerator.Common;
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
/// <summary>
/// Ein Befehl zum Zurücksetzen einer E-Mail-Vorlage auf die Standardwerte.
@@ -17,4 +19,4 @@
/// 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 UpdateToDefaultCommand(int? Id, Common.Constants.EmailTemplateType? Type) : EmailTemplateQuery(Id, Type);
public record ResetEnvelopeTemplateCommand(int? Id, Constants.EmailTemplateType? Type) : EmailTemplateQuery(Id, Type);

View File

@@ -1,18 +1,22 @@
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Update;
using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Update;
/// <summary>
/// Befehl zum Aktualisieren einer E-Mail-Vorlage.
/// </summary>
/// <param name="EmailTemplate">
/// Die Abfrage, die die E-Mail-Vorlage darstellt, die aktualisiert werden soll.
/// </param>
/// <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(EmailTemplateQuery EmailTemplate, string? Body = null, string? Subject = null)
public record UpdateEmailTemplateCommand(string? Body = null, string? Subject = null)
{
/// <param>
/// Die Abfrage, die die E-Mail-Vorlage darstellt, die aktualisiert werden soll.
/// </param>
[JsonIgnore]
public EmailTemplateQuery? EmailTemplateQuery { get; set; }
}

View File

@@ -1,4 +1,4 @@
namespace EnvelopeGenerator.Application.EmailTemplates.Query.Read;
namespace EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
/// <summary>