refactor(EnvelopeDocumentDto): rename as DocumentDto

This commit is contained in:
tekh 2025-09-09 18:52:58 +02:00
parent fbfc20705d
commit ec57906290
8 changed files with 16 additions and 16 deletions

View File

@ -6,7 +6,7 @@ namespace EnvelopeGenerator.Application.Common.Dto;
/// Data Transfer Object representing a document within an envelope, including optional binary data and form elements. /// Data Transfer Object representing a document within an envelope, including optional binary data and form elements.
/// </summary> /// </summary>
[ApiExplorerSettings(IgnoreApi = true)] [ApiExplorerSettings(IgnoreApi = true)]
public class EnvelopeDocumentDto public class DocumentDto
{ {
/// <summary> /// <summary>
/// Gets or sets the unique identifier of the document. /// Gets or sets the unique identifier of the document.

View File

@ -117,5 +117,5 @@ public record EnvelopeDto
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; } public IEnumerable<DocumentDto>? Documents { get; set; }
} }

View File

@ -28,7 +28,7 @@ public class MappingProfile : Profile
CreateMap<DocumentStatus, DocumentStatusDto>(); CreateMap<DocumentStatus, DocumentStatusDto>();
CreateMap<EmailTemplate, EmailTemplateDto>(); CreateMap<EmailTemplate, EmailTemplateDto>();
CreateMap<Envelope, EnvelopeDto>(); CreateMap<Envelope, EnvelopeDto>();
CreateMap<EnvelopeDocument, EnvelopeDocumentDto>(); CreateMap<EnvelopeDocument, DocumentDto>();
CreateMap<EnvelopeHistory, EnvelopeHistoryDto>(); CreateMap<EnvelopeHistory, EnvelopeHistoryDto>();
CreateMap<EnvelopeHistory, EnvelopeHistoryCreateDto>(); CreateMap<EnvelopeHistory, EnvelopeHistoryCreateDto>();
CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>(); CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>();
@ -44,7 +44,7 @@ public class MappingProfile : Profile
CreateMap<DocumentStatusDto, DocumentStatus>(); CreateMap<DocumentStatusDto, DocumentStatus>();
CreateMap<EmailTemplateDto, EmailTemplate>(); CreateMap<EmailTemplateDto, EmailTemplate>();
CreateMap<EnvelopeDto, Envelope>(); CreateMap<EnvelopeDto, Envelope>();
CreateMap<EnvelopeDocumentDto, EnvelopeDocument>(); CreateMap<DocumentDto, EnvelopeDocument>();
CreateMap<EnvelopeHistoryDto, EnvelopeHistory>(); CreateMap<EnvelopeHistoryDto, EnvelopeHistory>();
CreateMap<EnvelopeHistoryCreateDto, EnvelopeHistory>(); CreateMap<EnvelopeHistoryCreateDto, EnvelopeHistory>();
CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>(); CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>();

View File

@ -12,14 +12,14 @@ namespace EnvelopeGenerator.Application.Documents.Queries;
/// </summary> /// </summary>
/// <param name="Id">The unique identifier of the document. Optional.</param> /// <param name="Id">The unique identifier of the document. Optional.</param>
/// <param name="EnvelopeId">The identifier of the envelope associated with the document. Optional.</param> /// <param name="EnvelopeId">The identifier of the envelope associated with the document. Optional.</param>
public record ReadDocumentQuery(int? Id = null, int? EnvelopeId = null) : IRequest<EnvelopeDocumentDto?> public record ReadDocumentQuery(int? Id = null, int? EnvelopeId = null) : IRequest<DocumentDto?>
{ {
} }
/// <summary> /// <summary>
/// Handles queries for reading <see cref="EnvelopeDocument"/> data based on either the document ID or the envelope ID. /// Handles queries for reading <see cref="EnvelopeDocument"/> data based on either the document ID or the envelope ID.
/// </summary> /// </summary>
public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, EnvelopeDocumentDto?> public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, DocumentDto?>
{ {
/// <summary> /// <summary>
/// TempRepo for accessing <see cref="EnvelopeDocument"/> entities. /// TempRepo for accessing <see cref="EnvelopeDocument"/> entities.
@ -40,27 +40,27 @@ public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, Envel
} }
/// <summary> /// <summary>
/// Handles the <see cref="ReadDocumentQuery"/> and returns a <see cref="EnvelopeDocumentDto"/> based on the provided identifiers. /// Handles the <see cref="ReadDocumentQuery"/> and returns a <see cref="DocumentDto"/> based on the provided identifiers.
/// </summary> /// </summary>
/// <param name="query">The query containing the document ID or envelope ID to search for.</param> /// <param name="query">The query containing the document ID or envelope ID to search for.</param>
/// <param name="cancel">A token to monitor for cancellation requests.</param> /// <param name="cancel">A token to monitor for cancellation requests.</param>
/// <returns> /// <returns>
/// A <see cref="EnvelopeDocumentDto"/> if a matching document is found; otherwise, <c>null</c>. /// A <see cref="DocumentDto"/> if a matching document is found; otherwise, <c>null</c>.
/// </returns> /// </returns>
/// <exception cref="InvalidOperationException"> /// <exception cref="InvalidOperationException">
/// Thrown when neither <see cref="ReadDocumentQuery.Id"/> nor <see cref="ReadDocumentQuery.EnvelopeId"/> is provided. /// Thrown when neither <see cref="ReadDocumentQuery.Id"/> nor <see cref="ReadDocumentQuery.EnvelopeId"/> is provided.
/// </exception> /// </exception>
public async Task<EnvelopeDocumentDto?> Handle(ReadDocumentQuery query, CancellationToken cancel) public async Task<DocumentDto?> Handle(ReadDocumentQuery query, CancellationToken cancel)
{ {
if (query.Id is not null) if (query.Id is not null)
{ {
var doc = await _repo.ReadOnly().Where(d => d.Id == query.Id).FirstOrDefaultAsync(cancel); var doc = await _repo.ReadOnly().Where(d => d.Id == query.Id).FirstOrDefaultAsync(cancel);
return _mapper.Map<EnvelopeDocumentDto>(doc); return _mapper.Map<DocumentDto>(doc);
} }
else if (query.EnvelopeId is not null) else if (query.EnvelopeId is not null)
{ {
var doc = await _repo.ReadOnly().Where(d => d.EnvelopeId == query.EnvelopeId).FirstOrDefaultAsync(cancel); var doc = await _repo.ReadOnly().Where(d => d.EnvelopeId == query.EnvelopeId).FirstOrDefaultAsync(cancel);
return _mapper.Map<EnvelopeDocumentDto>(doc); return _mapper.Map<DocumentDto>(doc);
} }
throw new InvalidOperationException( throw new InvalidOperationException(

View File

@ -8,6 +8,6 @@ namespace EnvelopeGenerator.Application.Interfaces.Services;
/// ///
/// </summary> /// </summary>
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public interface IEnvelopeDocumentService : IBasicCRUDService<EnvelopeDocumentDto, EnvelopeDocument, int> public interface IEnvelopeDocumentService : IBasicCRUDService<DocumentDto, EnvelopeDocument, int>
{ {
} }

View File

@ -11,7 +11,7 @@ namespace EnvelopeGenerator.Application.Services;
/// ///
/// </summary> /// </summary>
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public class EnvelopeDocumentService : BasicCRUDService<IEnvelopeDocumentRepository, EnvelopeDocumentDto, EnvelopeDocument, int>, IEnvelopeDocumentService public class EnvelopeDocumentService : BasicCRUDService<IEnvelopeDocumentRepository, DocumentDto, EnvelopeDocument, int>, IEnvelopeDocumentService
{ {
/// <summary> /// <summary>
/// ///

View File

@ -170,7 +170,7 @@ public class HomeController : ViewControllerBase
if (await _historyService.IsSigned(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress)) if (await _historyService.IsSigned(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress))
return View("EnvelopeSigned"); return View("EnvelopeSigned");
if (er.Envelope.Documents?.FirstOrDefault() is EnvelopeDocumentDto doc && doc.ByteData is not null) if (er.Envelope.Documents?.FirstOrDefault() is DocumentDto doc && doc.ByteData is not null)
{ {
ViewData["DocumentBytes"] = doc.ByteData; ViewData["DocumentBytes"] = doc.ByteData;
} }
@ -473,7 +473,7 @@ public class HomeController : ViewControllerBase
_logger.LogNotice(hist_res.Notices); _logger.LogNotice(hist_res.Notices);
} }
if (er.Envelope.Documents?.FirstOrDefault() is EnvelopeDocumentDto doc && doc.ByteData is not null) if (er.Envelope.Documents?.FirstOrDefault() is DocumentDto doc && doc.ByteData is not null)
{ {
ViewData["DocumentBytes"] = doc.ByteData; ViewData["DocumentBytes"] = doc.ByteData;
ViewData["EnvelopeKey"] = envelopeKey; ViewData["EnvelopeKey"] = envelopeKey;

View File

@ -5,7 +5,7 @@ using EnvelopeGenerator.Application.Common.Dto;
namespace EnvelopeGenerator.Web.Controllers.Test; namespace EnvelopeGenerator.Web.Controllers.Test;
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public class TestEnvelopeDocumentController : TestControllerBase<IEnvelopeDocumentService, EnvelopeDocumentDto, EnvelopeDocument, int> public class TestEnvelopeDocumentController : TestControllerBase<IEnvelopeDocumentService, DocumentDto, EnvelopeDocument, int>
{ {
public TestEnvelopeDocumentController(ILogger<TestEnvelopeDocumentController> logger, IEnvelopeDocumentService service) : base(logger, service) public TestEnvelopeDocumentController(ILogger<TestEnvelopeDocumentController> logger, IEnvelopeDocumentService service) : base(logger, service)
{ {