feat(ReadDocumentMappingProfile): Added mapping profile of ReadDocumentResponse

This commit is contained in:
Developer 02 2025-04-23 00:01:57 +02:00
parent 8785505a91
commit 97dcc0f0a1
3 changed files with 41 additions and 12 deletions

View File

@ -0,0 +1,18 @@
using AutoMapper;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
/// <summary>
///
/// </summary>
public class ReadDocumentMappingProfile : Profile
{
/// <summary>
///
/// </summary>
public ReadDocumentMappingProfile()
{
CreateMap<EnvelopeDocument, ReadDocumentResponse>();
}
}

View File

@ -3,13 +3,25 @@
/// <summary>
/// Represents the response for reading a document.
/// </summary>
/// <param name="Guid">The unique identifier of the document.</param>
/// <param name="EnvelopeId">The identifier of the associated envelope.</param>
/// <param name="AddedWhen">The date and time when the document was added.</param>
/// <param name="ByteData">The binary data of the document, if available.</param>
public record ReadDocumentResponse(
int Guid,
int EnvelopeId,
DateTime AddedWhen,
byte[]? ByteData
);
public class ReadDocumentResponse
{
/// <summary>
/// The unique identifier of the document.
/// </summary>
public int Guid { get; init; }
/// <summary>
/// The identifier of the associated envelope.
/// </summary>
public int EnvelopeId { get; init; }
/// <summary>
/// The date and time when the document was added.
/// </summary>
public DateTime AddedWhen { get; init; }
/// <summary>
/// The binary data of the document, if available.
/// </summary>
public byte[]? ByteData { get; init; }
}

View File

@ -42,8 +42,7 @@ public static class DIExtensions
services.TryAddScoped<IEnvelopeReceiverReadOnlyService, EnvelopeReceiverReadOnlyService>();
//Auto mapping profiles
services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly);
services.AddAutoMapper(typeof(UserMappingProfile).Assembly);
services.AddAutoMapper(Assembly.GetExecutingAssembly());
services.Configure<DispatcherParams>(config.GetSection(nameof(DispatcherParams)));
services.Configure<MailParams>(config.GetSection(nameof(MailParams)));