Add ApiExplorerSettings to DTOs and update controllers

This commit introduces the `[ApiExplorerSettings(IgnoreApi = true)]` attribute to various DTO classes to exclude them from API documentation. The `using Microsoft.AspNetCore.Mvc;` directive has been added to several files to support ASP.NET Core MVC features.

Additionally, comments in `HistoryController.cs` have been reformatted for clarity, and `LocalizationController.cs` has been updated with standard API controller attributes. These changes improve code organization and maintain cleaner API documentation.
This commit is contained in:
Developer 02 2025-04-11 23:41:47 +02:00
parent 6e641395d5
commit e3dfa8dd39
24 changed files with 88 additions and 46 deletions

View File

@ -1,9 +1,11 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record ConfigDto( public record ConfigDto(
string DocumentPath, string DocumentPath,
int SendingProfile, int SendingProfile,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record DocumentReceiverElementDto( public record DocumentReceiverElementDto(
int Id, int Id,
int DocumentId, int DocumentId,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record DocumentStatusDto( public record DocumentStatusDto(
int Id, int Id,
int EnvelopeId, int EnvelopeId,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EmailTemplateDto( public record EmailTemplateDto(
int Id, int Id,
string Name, string Name,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeCertificateDto( public record EnvelopeCertificateDto(
int Id, int Id,
int EnvelopeId, int EnvelopeId,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeDocumentDto public record EnvelopeDocumentDto
( (
int Id, int Id,

View File

@ -2,9 +2,11 @@
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using DigitalData.UserManager.Application.DTOs.User; using DigitalData.UserManager.Application.DTOs.User;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeDto() : IUnique<int> public record EnvelopeDto() : IUnique<int>
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@ -1,5 +1,8 @@
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeHistoryCreateDto( public record EnvelopeHistoryCreateDto(
int EnvelopeId, int EnvelopeId,
string UserReference, string UserReference,

View File

@ -2,10 +2,12 @@
using DigitalData.Core.DTO; using DigitalData.Core.DTO;
using DigitalData.UserManager.Application.DTOs.User; using DigitalData.UserManager.Application.DTOs.User;
using EnvelopeGenerator.Application.DTOs.Receiver; using EnvelopeGenerator.Application.DTOs.Receiver;
using Microsoft.AspNetCore.Mvc;
using static EnvelopeGenerator.Common.Constants; using static EnvelopeGenerator.Common.Constants;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeHistoryDto( public record EnvelopeHistoryDto(
long Id, long Id,
int EnvelopeId, int EnvelopeId,

View File

@ -1,8 +1,10 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)> public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)>
{ {
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId); public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);

View File

@ -1,7 +1,9 @@
using EnvelopeGenerator.Application.DTOs.Receiver; using EnvelopeGenerator.Application.DTOs.Receiver;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto() public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
{ {
public EnvelopeDto? Envelope { get; set; } public EnvelopeDto? Envelope { get; set; }

View File

@ -1,5 +1,8 @@
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto() public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto()
{ {
public string? AccessCode { get; init; } public string? AccessCode { get; init; }

View File

@ -1,8 +1,10 @@
using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverReadOnlyCreateDto( public record EnvelopeReceiverReadOnlyCreateDto(
DateTime DateValid) DateTime DateValid)
{ {

View File

@ -1,7 +1,9 @@
using EnvelopeGenerator.Application.DTOs.Receiver; using EnvelopeGenerator.Application.DTOs.Receiver;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverReadOnlyDto( public record EnvelopeReceiverReadOnlyDto(
long Id, long Id,
long EnvelopeId, long EnvelopeId,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverReadOnlyUpdateDto( public record EnvelopeReceiverReadOnlyUpdateDto(
long Id, long Id,
DateTime DateValid, DateTime DateValid,

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeTypeDto( public record EnvelopeTypeDto(
int Id, int Id,
string Title, string Title,

View File

@ -1,4 +1,7 @@
namespace EnvelopeGenerator.Application.DTOs.Messaging using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.Messaging
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public class GtxMessagingResponse : Dictionary<string, object?> { } public class GtxMessagingResponse : Dictionary<string, object?> { }
} }

View File

@ -1,5 +1,8 @@
namespace EnvelopeGenerator.Application.DTOs.Messaging using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.Messaging
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record SmsResponse public record SmsResponse
{ {
public required bool Ok { get; init; } public required bool Ok { get; init; }

View File

@ -1,9 +1,11 @@
using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace EnvelopeGenerator.Application.DTOs.Receiver namespace EnvelopeGenerator.Application.DTOs.Receiver
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null) public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null)
{ {
public string Signature => sha256HexOfMail.Value; public string Signature => sha256HexOfMail.Value;

View File

@ -2,10 +2,12 @@
using DigitalData.Core.DTO; using DigitalData.Core.DTO;
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver; using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
using Microsoft.AspNetCore.Mvc;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.DTOs.Receiver; namespace EnvelopeGenerator.Application.DTOs.Receiver;
[ApiExplorerSettings(IgnoreApi = true)]
public record ReceiverReadDto( public record ReceiverReadDto(
int Id, int Id,
string EmailAddress, string EmailAddress,

View File

@ -1,5 +1,7 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.Receiver; namespace EnvelopeGenerator.Application.DTOs.Receiver;
[ApiExplorerSettings(IgnoreApi = true)]
public record ReceiverUpdateDto(int Id, string? TotpSecretkey = null, DateTime? TfaRegDeadline = null) : IUnique<int>; public record ReceiverUpdateDto(int Id, string? TotpSecretkey = null, DateTime? TfaRegDeadline = null) : IUnique<int>;

View File

@ -1,7 +1,9 @@
using DigitalData.Core.Abstractions; using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs namespace EnvelopeGenerator.Application.DTOs
{ {
[ApiExplorerSettings(IgnoreApi = true)]
public record UserReceiverDto( public record UserReceiverDto(
int Id, int Id,
int UserId, int UserId,

View File

@ -3,9 +3,6 @@ using EnvelopeGenerator.Application.Contracts.Services;
using EnvelopeGenerator.Application.Histories.Queries.Read; using EnvelopeGenerator.Application.Histories.Queries.Read;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.Drawing;
using System.Runtime.ConstrainedExecution;
using static EnvelopeGenerator.Common.Constants; using static EnvelopeGenerator.Common.Constants;
@ -37,16 +34,14 @@ public class HistoryController : ControllerBase
/// <summary> /// <summary>
/// Gibt alle möglichen Verweise auf alle möglichen Status in einem Verlaufsdatensatz zurück. (z. B. DocumentSigned bezieht sich auf Receiver.) /// Gibt alle möglichen Verweise auf alle möglichen Status in einem Verlaufsdatensatz zurück. (z. B. DocumentSigned bezieht sich auf Receiver.)
/// Dies wird hinzugefügt, damit Client-Anwendungen sich selbst auf dem neuesten Stand halten können. /// Dies wird hinzugefügt, damit Client-Anwendungen sich selbst auf dem neuesten Stand halten können.
/// <list type="bullet"> /// 0 - Receiver:
/// <item><description><c>0 - Receiver</c>: /// Historische Datensätze, die sich auf den Status des Absenders beziehen. Sie haben Statuscodes, die mit 1* beginnen.
/// Historische Datensätze, die sich auf den Status des Absenders beziehen. Sie haben Statuscodes, die mit 1* beginnen.</description></item> /// 1 - Sender:
/// <item><description><c>1 - Sender</c>: /// Historische Datensätze über den Status der Empfänger. Diese haben Statuscodes, die mit 2* beginnen.
/// Historische Datensätze über den Status der Empfänger. Diese haben Statuscodes, die mit 2* beginnen.</description></item> /// 2 - System:
/// <item><description><c>2 - System</c>: /// Historische Datensätze, die sich auf den allgemeinen Zustand des Umschlags beziehen. Diese haben Statuscodes, die mit 3* beginnen.
/// Historische Datensätze, die sich auf den allgemeinen Zustand des Umschlags beziehen. Diese haben Statuscodes, die mit 3* beginnen.</description></item> /// 3 - Unknown:
/// <item><description><c>3 - Unknown</c>: /// Ein unbekannter Datensatz weist auf einen möglichen Mangel oder eine Unstimmigkeit im Aktualisierungsprozess der Anwendung hin.
/// Ein unbekannter Datensatz weist auf einen möglichen Mangel oder eine Unstimmigkeit im Aktualisierungsprozess der Anwendung hin.</description></item>
/// </list>
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
/// <response code="200"></response> /// <response code="200"></response>
@ -70,33 +65,31 @@ public class HistoryController : ControllerBase
/// <summary> /// <summary>
/// Gibt alle möglichen Status in einem Verlaufsdatensatz zurück. /// Gibt alle möglichen Status in einem Verlaufsdatensatz zurück.
/// Dies wird hinzugefügt, damit Client-Anwendungen sich selbst auf dem neuesten Stand halten können. /// Dies wird hinzugefügt, damit Client-Anwendungen sich selbst auf dem neuesten Stand halten können.
/// <list type="bullet"> /// 0: Invalid
/// <item><description><c>0</c>: Invalid</description></item> /// 1001: EnvelopeCreated
/// <item><description><c>1001</c>: EnvelopeCreated</description></item> /// 1002: EnvelopeSaved
/// <item><description><c>1002</c>: EnvelopeSaved</description></item> /// 1003: EnvelopeQueued
/// <item><description><c>1003</c>: EnvelopeQueued</description></item> /// 1004: EnvelopeSent (Nicht verwendet)
/// <item><description><c>1004</c>: EnvelopeSent (Nicht verwendet)</description></item> /// 1005: EnvelopePartlySigned
/// <item><description><c>1005</c>: EnvelopePartlySigned</description></item> /// 1006: EnvelopeCompletelySigned
/// <item><description><c>1006</c>: EnvelopeCompletelySigned</description></item> /// 1007: EnvelopeReportCreated
/// <item><description><c>1007</c>: EnvelopeReportCreated</description></item> /// 1008: EnvelopeArchived
/// <item><description><c>1008</c>: EnvelopeArchived</description></item> /// 1009: EnvelopeDeleted
/// <item><description><c>1009</c>: EnvelopeDeleted</description></item> /// 2001: AccessCodeRequested
/// <item><description><c>2001</c>: AccessCodeRequested</description></item> /// 2002: AccessCodeCorrect
/// <item><description><c>2002</c>: AccessCodeCorrect</description></item> /// 2003: AccessCodeIncorrect
/// <item><description><c>2003</c>: AccessCodeIncorrect</description></item> /// 2004: DocumentOpened
/// <item><description><c>2004</c>: DocumentOpened</description></item> /// 2005: DocumentSigned
/// <item><description><c>2005</c>: DocumentSigned</description></item> /// 4001: DocumentForwarded
/// <item><description><c>4001</c>: DocumentForwarded</description></item> /// 2006: SignatureConfirmed
/// <item><description><c>2006</c>: SignatureConfirmed</description></item> /// 2007: DocumentRejected
/// <item><description><c>2007</c>: DocumentRejected</description></item> /// 2008: EnvelopeShared
/// <item><description><c>2008</c>: EnvelopeShared</description></item> /// 2009: EnvelopeViewed
/// <item><description><c>2009</c>: EnvelopeViewed</description></item> /// 3001: MessageInvitationSent (Wird von Trigger verwendet)
/// <item><description><c>3001</c>: MessageInvitationSent (Wird von Trigger verwendet)</description></item> /// 3002: MessageAccessCodeSent
/// <item><description><c>3002</c>: MessageAccessCodeSent</description></item> /// 3003: MessageConfirmationSent
/// <item><description><c>3003</c>: MessageConfirmationSent</description></item> /// 3004: MessageDeletionSent
/// <item><description><c>3004</c>: MessageDeletionSent</description></item> /// 3005: MessageCompletionSent
/// <item><description><c>3005</c>: MessageCompletionSent</description></item>
/// </list>
/// </summary> /// </summary>
/// <param name="related"> /// <param name="related">
/// Abfrageparameter, der angibt, auf welche Referenz sich der Status bezieht. /// Abfrageparameter, der angibt, auf welche Referenz sich der Status bezieht.

View File

@ -11,6 +11,7 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers;
/// <summary> /// <summary>
/// Controller für die Verwaltung der Lokalisierung und Spracheinstellungen. /// Controller für die Verwaltung der Lokalisierung und Spracheinstellungen.
/// </summary> /// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]
public class LocalizationController : ControllerBase public class LocalizationController : ControllerBase