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.
This commit is contained in:
parent
7d07fc58e9
commit
f10f5af541
15
src/WorkFlow.Application/Dto/ObjectStateHistDto.cs
Normal file
15
src/WorkFlow.Application/Dto/ObjectStateHistDto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace WorkFlow.Application.Dto;
|
||||
|
||||
public record ObjectStateHistDto
|
||||
{
|
||||
public virtual string? Intl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds state 2, 3 and 4 as a list of strings.
|
||||
/// </summary>
|
||||
public IEnumerable<string> Others { get; set; } = Array.Empty<string>();
|
||||
|
||||
public string? ChangedWho { get; set; }
|
||||
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
}
|
||||
@ -19,5 +19,8 @@ public class MappingProfile : AutoMapper.Profile
|
||||
CreateMap<PObjectState, ObjectStateDto>()
|
||||
.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<PObjectStateHist, ObjectStateHistDto>()
|
||||
.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 }));
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user