Remove ProfileObjStateDto and update mappings

- Deleted the `ProfileObjStateDto` class and its `States` property.
- Removed mapping for `ProfileObjState` to `ProfileObjStateDto` in `MappingProfile`.
- Updated `States` mapping to handle null values by converting to a list or returning an empty array.
- Replaced `States` property in `ProfileObjState` with a `ToList()` method that aggregates state values.
This commit is contained in:
tekh 2025-08-01 09:41:16 +02:00
parent bb29b1563a
commit b89a69b0f3
3 changed files with 2 additions and 10 deletions

View File

@ -1,6 +0,0 @@
namespace WorkFlow.Application.Dto;
public class ProfileObjStateDto
{
public IEnumerable<string?> States { get; set; } = Array.Empty<string>();
}

View File

@ -12,7 +12,6 @@ public class MappingProfile : AutoMapper.Profile
CreateMap<Config, ConfigDto>();
CreateMap<Profile, ProfileDto>();
CreateMap<ProfileControlsTF, ProfileControlsTFDto>();
CreateMap<ProfileObjState, ProfileObjStateDto>();
CreateMap<State, StateDto>();
CreateMap<Button, ButtonDto>();
CreateMap<ProfileObject, ObjectDto>()
@ -20,6 +19,6 @@ public class MappingProfile : AutoMapper.Profile
new[] { src.Headline1, src.Headline2 }))
.ForMember(dest => dest.Sublines, opt => opt.MapFrom(src =>
new[] { src.Subline1, src.Subline2 }))
.ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States));
.ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States != null ? src.States.ToList() : Array.Empty<string>()));
}
}

View File

@ -82,8 +82,7 @@ public class ProfileObjState
[ForeignKey("StateId")]
public virtual State? State1 { get; set; }
[NotMapped]
public IEnumerable<string?> States => new List<string?>
public IEnumerable<string?> ToList() => new List<string?>
{
State1?.IntlState, State2, State3, State4
};