diff --git a/EnvelopeGenerator.Application/DTOs/MappingProfile.cs b/EnvelopeGenerator.Application/DTOs/MappingProfile.cs new file mode 100644 index 00000000..3dd3797a --- /dev/null +++ b/EnvelopeGenerator.Application/DTOs/MappingProfile.cs @@ -0,0 +1,70 @@ +using AutoMapper; +using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; +using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver; +using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly; +using EnvelopeGenerator.Application.DTOs.Messaging; +using EnvelopeGenerator.Application.DTOs.Receiver; +using EnvelopeGenerator.Application.Extensions; +using EnvelopeGenerator.Domain.Entities; + +namespace EnvelopeGenerator.Application.DTOs; + +/// +/// Represents the AutoMapper profile configuration for mapping between +/// domain entities and data transfer objects (DTOs) used within the EnvelopeGenerator application. +/// +public class MappingProfile : Profile +{ + /// + /// Initializes a new instance of the class. + /// Configures the mappings between entities and DTOs used throughout the application. + /// + public MappingProfile() + { + // Entity to DTO mappings + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + + // DTO to Entity mappings + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore()); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + + // Messaging mappings + // for GTX messaging + CreateMap() + .ConstructUsing(gtxRes => gtxRes.Ok() + ? new SmsResponse() { Ok = true } + : new SmsResponse() { Ok = false, Errors = gtxRes }); + } +} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs b/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs deleted file mode 100644 index ae14252e..00000000 --- a/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs +++ /dev/null @@ -1,64 +0,0 @@ -using AutoMapper; -using EnvelopeGenerator.Application.DTOs; -using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; -using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver; -using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly; -using EnvelopeGenerator.Application.DTOs.Messaging; -using EnvelopeGenerator.Application.DTOs.Receiver; -using EnvelopeGenerator.Application.Extensions; -using EnvelopeGenerator.Domain.Entities; - -namespace EnvelopeGenerator.Application.MappingProfiles -{ - public class BasicDtoMappingProfile : Profile - { - public BasicDtoMappingProfile() - { - // Entity to DTO mappings - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - // DTO to Entity mappings - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore()); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - // Messaging mappings - // for GTX messaging - CreateMap() - .ConstructUsing(gtxRes => gtxRes.Ok() - ? new SmsResponse() { Ok = true } - : new SmsResponse() { Ok = false, Errors = gtxRes }); - } - } -} \ No newline at end of file