Updated project and solution files to rename and restructure `DocumentOperator` to `DocumentService`. Modified project references in `DocumentService.API.csproj`, `DocumentService.Application.csproj`, and `DocumentService.Infrastructure.csproj` to reflect the new naming convention. Updated `DocumentService.sln` to remove old project references, add new ones, and adjust configuration and nested project mappings accordingly. This change aligns the project structure with the new naming convention.
49 lines
2.4 KiB
C#
49 lines
2.4 KiB
C#
using AutoMapper;
|
|
using Codecrete.SwissQRBill.Generator;
|
|
using DocumentService.Application.Common.DTOs;
|
|
using DocumentService.Domain.Models.ValueObjects;
|
|
|
|
namespace DocumentService.Application.Common.Mapping;
|
|
|
|
/// <summary>
|
|
/// AutoMapper profile for mapping domain entities and external models to DTOs.
|
|
/// NOTE: Always use AutoMapper for all mappings in this project.
|
|
/// </summary>
|
|
public class MappingProfile : Profile
|
|
{
|
|
public MappingProfile()
|
|
{
|
|
|
|
// Codecrete Bill -> SwissQrBillDto
|
|
CreateMap<Bill, SwissQrBillDto>()
|
|
.ForMember(dest => dest.Version, opt => opt.MapFrom(src => src.Version.ToString()))
|
|
.ForMember(dest => dest.Currency, opt => opt.MapFrom(src => src.Currency ?? "CHF"))
|
|
.ForMember(dest => dest.Account, opt => opt.MapFrom(src => src.Account ?? string.Empty))
|
|
.ForMember(dest => dest.ReferenceType, opt => opt.MapFrom(src => src.ReferenceType ?? Bill.ReferenceTypeNoRef));
|
|
|
|
// Codecrete Address -> AddressDto
|
|
CreateMap<Address, AddressDto>()
|
|
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.Type.ToString()))
|
|
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name ?? string.Empty))
|
|
.ForMember(dest => dest.PostalCode, opt => opt.MapFrom(src => src.PostalCode ?? string.Empty))
|
|
.ForMember(dest => dest.Town, opt => opt.MapFrom(src => src.Town ?? string.Empty))
|
|
.ForMember(dest => dest.CountryCode, opt => opt.MapFrom(src => src.CountryCode ?? string.Empty))
|
|
#pragma warning disable CS0618 // Suppress obsolete warning for AddressLine1/2 mapping
|
|
.ForMember(dest => dest.AddressLine1, opt => opt.MapFrom(src => src.AddressLine1))
|
|
.ForMember(dest => dest.AddressLine2, opt => opt.MapFrom(src => src.AddressLine2));
|
|
#pragma warning restore CS0618
|
|
|
|
// Codecrete AlternativeScheme -> AlternativeSchemeDto
|
|
CreateMap<AlternativeScheme, AlternativeSchemeDto>()
|
|
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name ?? string.Empty))
|
|
.ForMember(dest => dest.Instruction, opt => opt.MapFrom(src => src.Instruction ?? string.Empty));
|
|
|
|
// AttachmentInfo -> AttachmentCheckResult
|
|
CreateMap<AttachmentInfo, AttachmentCheckResult>();
|
|
|
|
// AttachmentMetadata -> AttachmentDto
|
|
CreateMap<AttachmentMetadata, AttachmentDto>()
|
|
.ForMember(dest => dest.Size, opt => opt.MapFrom(src => src.SizeBytes));
|
|
}
|
|
}
|