diff --git a/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs b/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs index 3cc045a..a07dba4 100644 --- a/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs +++ b/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs @@ -3,21 +3,21 @@ namespace WorkFlow.Application.Contracts.Repositories; /// -/// Repository for retrieving entities from the database. +/// Repository for retrieving entities from the database. /// public interface IProfileObjRepository { /// - /// Retrieves the list of associated with a given user ID and profile ID by calling a database function. + /// Retrieves the list of associated with a given user ID and profile ID by calling a database function. /// /// The unique identifier of the user whose profile is to be retrieved. /// The unique identifier of the profile whose object is to be retrieved. /// Propagates notification that operations should be canceled. /// - /// A task that represents the asynchronous operation. The task result contains the object if found; otherwise, null. + /// A task that represents the asynchronous operation. The task result contains the object if found; otherwise, null. /// /// /// Logs an error if no profile is found, or if multiple profiles are returned, indicating potential data issues. /// - public Task> ReadAsync(int userId, int profileId, CancellationToken cancel = default); + public Task> ReadAsync(int userId, int profileId, CancellationToken cancel = default); } \ No newline at end of file diff --git a/src/WorkFlow.Application/Dto/ObjectDto.cs b/src/WorkFlow.Application/Dto/ObjectDto.cs index eb192f7..f828c41 100644 --- a/src/WorkFlow.Application/Dto/ObjectDto.cs +++ b/src/WorkFlow.Application/Dto/ObjectDto.cs @@ -13,4 +13,6 @@ public class ObjectDto public string? CmdCheckIn { get; set; } public IEnumerable States { get; set; } = Array.Empty(); + + public IEnumerable TFControls { get; set; } = Array.Empty(); } diff --git a/src/WorkFlow.Application/MappingProfile.cs b/src/WorkFlow.Application/MappingProfile.cs index fbc920b..728af79 100644 --- a/src/WorkFlow.Application/MappingProfile.cs +++ b/src/WorkFlow.Application/MappingProfile.cs @@ -11,14 +11,13 @@ public class MappingProfile : AutoMapper.Profile // Mapping entity to DTO CreateMap(); CreateMap(); - CreateMap(); + CreateMap(); CreateMap(); CreateMap(); - CreateMap() - .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 })) - .ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States != null ? src.States.ToList() : Array.Empty())); + CreateMap() + .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 })) + .ForMember(dest => dest.States, opt => opt.MapFrom(src => src.State != null ? src.State.ToList() : Array.Empty())) + .ForMember(dest => dest.TFControls, opt => opt.MapFrom(src => src.State != null ? src.State.TFControls : null)); } } \ No newline at end of file diff --git a/src/WorkFlow.Domain/Entities/ProfileControlsTF.cs b/src/WorkFlow.Domain/Entities/PControlsTF.cs similarity index 88% rename from src/WorkFlow.Domain/Entities/ProfileControlsTF.cs rename to src/WorkFlow.Domain/Entities/PControlsTF.cs index 10d2deb..f94c3cc 100644 --- a/src/WorkFlow.Domain/Entities/ProfileControlsTF.cs +++ b/src/WorkFlow.Domain/Entities/PControlsTF.cs @@ -4,20 +4,15 @@ using System.ComponentModel.DataAnnotations.Schema; namespace WorkFlow.Domain.Entities; [Table("TBMWF_PROF_CONTROLS_TF", Schema = "dbo")] -public class ProfileControlsTF +public class PControlsTF { [Key] [Column("GUID", TypeName = "bigint")] public long Id { get; set; } - /// - /// Although this field is marked as nullable in the database schema to allow - /// for greater flexibility during database-level operations or migrations, it is - /// treated as required and not null within the application logic. - /// Validation should be enforced at the application level to ensure a value is provided. - /// + [Required] [Column("OBJ_STATE_ID", TypeName = "bigint")] - public long? ObjStateId { get; set; } + public long ObjStateId { get; set; } /// /// Although this field is marked as nullable in the database schema to allow @@ -96,7 +91,4 @@ public class ProfileControlsTF [Column("ADDED_WHEN", TypeName = "datetime")] public DateTime AddedWhen { get; set; } - - [ForeignKey("ObjStateId")] - public virtual ProfileObjState? State { get; set; } } \ No newline at end of file diff --git a/src/WorkFlow.Domain/Entities/ProfileObjects.cs b/src/WorkFlow.Domain/Entities/PObject.cs similarity index 87% rename from src/WorkFlow.Domain/Entities/ProfileObjects.cs rename to src/WorkFlow.Domain/Entities/PObject.cs index 7a4bbff..b441493 100644 --- a/src/WorkFlow.Domain/Entities/ProfileObjects.cs +++ b/src/WorkFlow.Domain/Entities/PObject.cs @@ -2,7 +2,7 @@ namespace WorkFlow.Domain.Entities; -public class ProfileObject +public class PObject { [Column("ObjStateID")] public long? ObjStateId { get; set; } @@ -26,5 +26,5 @@ public class ProfileObject public string? CmdCheckIn { get; set; } [ForeignKey("ObjStateId")] - public virtual ProfileObjState? States { get; set; } + public virtual PObjectState? State { get; set; } } \ No newline at end of file diff --git a/src/WorkFlow.Domain/Entities/ProfileObjState.cs b/src/WorkFlow.Domain/Entities/PObjectState.cs similarity index 96% rename from src/WorkFlow.Domain/Entities/ProfileObjState.cs rename to src/WorkFlow.Domain/Entities/PObjectState.cs index 5eec74c..b3f8019 100644 --- a/src/WorkFlow.Domain/Entities/ProfileObjState.cs +++ b/src/WorkFlow.Domain/Entities/PObjectState.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace WorkFlow.Domain.Entities; [Table("TBMWF_PROFILE_OBJ_STATE", Schema = "dbo")] -public class ProfileObjState +public class PObjectState { [Key] [Column("GUID", TypeName = "bigint")] @@ -82,7 +82,7 @@ public class ProfileObjState [ForeignKey("ObjStateId")] public virtual State? State1 { get; set; } - public IEnumerable TFControls { get; set; } = Array.Empty(); + public IEnumerable TFControls { get; set; } = Array.Empty(); public IEnumerable ToList() => new List { diff --git a/src/WorkFlow.Domain/Entities/Profile.cs b/src/WorkFlow.Domain/Entities/Profile.cs index d0ebd98..92add12 100644 --- a/src/WorkFlow.Domain/Entities/Profile.cs +++ b/src/WorkFlow.Domain/Entities/Profile.cs @@ -26,7 +26,7 @@ public class Profile public string? BackColor { get; set; } [NotMapped] - public IEnumerable? Objects { get; set; } + public IEnumerable? Objects { get; set; } [NotMapped] public IEnumerable