This commit implements a complete rebranding of the project: - Updated all namespaces from `DocumentOperator` to `DocumentService`. - Renamed file paths, embedded resources, and test data references. - Updated configuration keys, logging paths, and Redis instance names. - Revised documentation to reflect the new project name. - Modified project and solution files to align with the new structure. - Updated class names, DTOs, commands, queries, and handlers. - Adjusted middleware, controllers, and API endpoints. - Updated Swagger metadata and API titles to `DocumentService API`. - Refactored test namespaces, resource paths, and embedded resources. - Updated build and deployment configurations for the new name. - Replaced all references to `DocumentOperator` in comments and literals. These changes ensure consistency across the codebase and documentation.
55 lines
2.7 KiB
C#
55 lines
2.7 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()
|
|
{
|
|
// PdfMetadata -> PdfValidationResult
|
|
CreateMap<PdfMetadata, PdfValidationResult>();
|
|
|
|
// PdfAMetadata -> PdfAValidationResult
|
|
CreateMap<PdfAMetadata, PdfAValidationResult>()
|
|
.ForMember(dest => dest.FileSize, opt => opt.MapFrom(src => src.FileSizeBytes));
|
|
|
|
// 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));
|
|
}
|
|
}
|