Enhance state management in DTOs and entities
- Added `States` property to `ProfileObjStateDto` and `ObjectDto`. - Updated `MappingProfile` to include new `States` mapping. - Made `StateId` in `ProfileObjState` required and added `State1` navigation property. - Changed `ProfileObject` to use `States` instead of `State`. - Cleaned up `State` class structure and removed redundant namespaces. - Updated `ProfileObjRepository` to fetch related state data.
This commit is contained in:
@@ -1,18 +1,6 @@
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using WorkFlow.Application.Dto.State;
|
||||
namespace WorkFlow.Application.Dto.ProfileObjState;
|
||||
|
||||
namespace WorkFlow.Application.Dto.ProfileObjState
|
||||
public class ProfileObjStateDto
|
||||
{
|
||||
public record ProfileObjStateDto(int Id,
|
||||
int ProfileId,
|
||||
int UserId,
|
||||
long ObjId,
|
||||
int StateId,
|
||||
string AddedWho,
|
||||
DateTime AddedWhen,
|
||||
string? State2 = null,
|
||||
string? State3 = null,
|
||||
string? State4 = null,
|
||||
UserReadDto? User = null,
|
||||
StateDto? State = null);
|
||||
public IEnumerable<string?> States { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
@@ -11,4 +11,6 @@ public class ObjectDto
|
||||
public IEnumerable<string> Sublines { get; set; } = Array.Empty<string>();
|
||||
|
||||
public string? CmdCheckIn { get; set; }
|
||||
|
||||
public IEnumerable<string?> States { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class MappingProfile : AutoMapper.Profile
|
||||
.ForMember(dest => dest.Headlines, opt => opt.MapFrom(src =>
|
||||
new[] { src.Headline1, src.Headline2 }))
|
||||
.ForMember(dest => dest.Sublines, opt => opt.MapFrom(src =>
|
||||
new[] { src.Subline1, src.Subline2 }));
|
||||
|
||||
new[] { src.Subline1, src.Subline2 }))
|
||||
.ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States));
|
||||
|
||||
// Mapping create-DTO to entity
|
||||
CreateMap<ConfigCreateDto, Config>();
|
||||
|
||||
Reference in New Issue
Block a user