From f10f5af54127e15c2d75ba31ec823af9c3a8328a Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 1 Aug 2025 14:00:26 +0200 Subject: [PATCH] Add mapping for PObjectStateHist and new DTO record Introduced a mapping configuration in `MappingProfile` to map `PObjectStateHist` to `ObjectStateHistDto`, including the `Intl` property and an array of `Others`. Added a new record `ObjectStateHistDto` with properties for `Intl`, `Others`, `ChangedWho`, and `ChangedWhen`, initializing `Others` to an empty array of strings. --- .../Dto/ObjectStateHistDto.cs | 15 +++++++++++++++ src/WorkFlow.Application/MappingProfile.cs | 3 +++ 2 files changed, 18 insertions(+) create mode 100644 src/WorkFlow.Application/Dto/ObjectStateHistDto.cs diff --git a/src/WorkFlow.Application/Dto/ObjectStateHistDto.cs b/src/WorkFlow.Application/Dto/ObjectStateHistDto.cs new file mode 100644 index 0000000..424629d --- /dev/null +++ b/src/WorkFlow.Application/Dto/ObjectStateHistDto.cs @@ -0,0 +1,15 @@ +namespace WorkFlow.Application.Dto; + +public record ObjectStateHistDto +{ + public virtual string? Intl { get; set; } + + /// + /// Holds state 2, 3 and 4 as a list of strings. + /// + public IEnumerable Others { get; set; } = Array.Empty(); + + public string? ChangedWho { get; set; } + + public DateTime? ChangedWhen { get; set; } +} diff --git a/src/WorkFlow.Application/MappingProfile.cs b/src/WorkFlow.Application/MappingProfile.cs index 62783e5..c5e3c4f 100644 --- a/src/WorkFlow.Application/MappingProfile.cs +++ b/src/WorkFlow.Application/MappingProfile.cs @@ -19,5 +19,8 @@ public class MappingProfile : AutoMapper.Profile CreateMap() .ForMember(dest => dest.Intl, opt => opt.MapFrom(src => src.State1 != null ? src.State1.IntlState : null)) .ForMember(dest => dest.Others, opt => opt.MapFrom(src => new string?[] { src.State2, src.State3, src.State4 })); + CreateMap() + .ForMember(dest => dest.Intl, opt => opt.MapFrom(src => src.State1 != null ? src.State1.IntlState : null)) + .ForMember(dest => dest.Others, opt => opt.MapFrom(src => new string?[] { src.State2, src.State3, src.State4 })); } } \ No newline at end of file