Refactor DTOs and MappingProfile for consistency
Standardized namespaces for DTO classes and redefined several records to include necessary properties. Removed mapping configurations from MappingProfile, indicating a potential refactor. Introduced ProfileObjStateDto with a States property and ensured ProfileControlsTFDto and StateDto are properly encapsulated.
This commit is contained in:
parent
ad023b01d3
commit
bb29b1563a
@ -1,4 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.Config
|
|
||||||
{
|
|
||||||
public record ConfigCreateDto(string Title, string String);
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.Config
|
|
||||||
{
|
|
||||||
public record ConfigUpdateDto(string Title, string String) : BaseUpdateDto;
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.ProfileControlsTF
|
|
||||||
{
|
|
||||||
public record ProfileControlsTFCreateDto(
|
|
||||||
int ProfileId,
|
|
||||||
int UserId,
|
|
||||||
long ObjId,
|
|
||||||
string ObjType,
|
|
||||||
string AttrName,
|
|
||||||
string CtrlType,
|
|
||||||
string CtrlCaption,
|
|
||||||
bool Mandatory,
|
|
||||||
bool ReadOnly,
|
|
||||||
string? ChoiceList = null) : BaseCreateDto;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.ProfileControlsTF;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This Data Transfer Object (DTO) serves as a placeholder and does not support updates.
|
|
||||||
/// </summary>
|
|
||||||
public record ProfileControlsTFUpdateDto(long Id);
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.ProfileObjState
|
|
||||||
{
|
|
||||||
public record ProfileObjStateCreateDto(
|
|
||||||
int ProfileId,
|
|
||||||
int UserId,
|
|
||||||
long ObjId,
|
|
||||||
int StateId,
|
|
||||||
string? State2 = null,
|
|
||||||
string? State3 = null,
|
|
||||||
string? State4 = null) : BaseCreateDto;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.ProfileObjState;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This Data Transfer Object (DTO) serves as a placeholder and does not support updates.
|
|
||||||
/// </summary>
|
|
||||||
public record ProfileObjStateUpdateDto(long Id);
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.State
|
|
||||||
{
|
|
||||||
public record StateCreateDto(string IntlState) : BaseCreateDto;
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
namespace WorkFlow.Application.Dto.State;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This Data Transfer Object (DTO) serves as a placeholder and does not support updates.
|
|
||||||
/// </summary>
|
|
||||||
public record StateUpdateDto(int Id);
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace WorkFlow.Application.Dto.Config
|
namespace WorkFlow.Application.Dto
|
||||||
{
|
{
|
||||||
public record ConfigDto(int Id,
|
public record ConfigDto(int Id,
|
||||||
string Title,
|
string Title,
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
|
||||||
namespace WorkFlow.Application.Dto.ProfileControlsTF
|
namespace WorkFlow.Application.Dto
|
||||||
{
|
{
|
||||||
public record ProfileControlsTFDto(int Id,
|
public record ProfileControlsTFDto(int Id,
|
||||||
int ProfileId,
|
int ProfileId,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace WorkFlow.Application.Dto.ProfileObjState;
|
namespace WorkFlow.Application.Dto;
|
||||||
|
|
||||||
public class ProfileObjStateDto
|
public class ProfileObjStateDto
|
||||||
{
|
{
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace WorkFlow.Application.Dto.State
|
namespace WorkFlow.Application.Dto
|
||||||
{
|
{
|
||||||
public record StateDto(int Id, string IntlState, string AddedWho, DateTime AddedWhen);
|
public record StateDto(int Id, string IntlState, string AddedWho, DateTime AddedWhen);
|
||||||
}
|
}
|
||||||
@ -1,9 +1,5 @@
|
|||||||
using WorkFlow.Application.Buttons;
|
using WorkFlow.Application.Buttons;
|
||||||
using WorkFlow.Application.Dto;
|
using WorkFlow.Application.Dto;
|
||||||
using WorkFlow.Application.Dto.Config;
|
|
||||||
using WorkFlow.Application.Dto.ProfileControlsTF;
|
|
||||||
using WorkFlow.Application.Dto.ProfileObjState;
|
|
||||||
using WorkFlow.Application.Dto.State;
|
|
||||||
using WorkFlow.Domain.Entities;
|
using WorkFlow.Domain.Entities;
|
||||||
|
|
||||||
namespace WorkFlow.Application;
|
namespace WorkFlow.Application;
|
||||||
@ -25,17 +21,5 @@ public class MappingProfile : AutoMapper.Profile
|
|||||||
.ForMember(dest => dest.Sublines, opt => opt.MapFrom(src =>
|
.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));
|
.ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States));
|
||||||
|
|
||||||
// Mapping create-DTO to entity
|
|
||||||
CreateMap<ConfigCreateDto, Config>();
|
|
||||||
CreateMap<ProfileControlsTFCreateDto, ProfileControlsTF>();
|
|
||||||
CreateMap<ProfileObjStateCreateDto, ProfileObjState>();
|
|
||||||
CreateMap<StateCreateDto, State>();
|
|
||||||
|
|
||||||
// Mapping update-DTO to entity
|
|
||||||
CreateMap<ConfigUpdateDto, Config>();
|
|
||||||
CreateMap<ProfileControlsTFUpdateDto, ProfileControlsTF>();
|
|
||||||
CreateMap<ProfileObjStateUpdateDto, ProfileObjState>();
|
|
||||||
CreateMap<StateUpdateDto, State>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,9 +3,6 @@ using DigitalData.Core.Infrastructure.AutoMapper;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
using WorkFlow.Application.Contracts.Repositories;
|
using WorkFlow.Application.Contracts.Repositories;
|
||||||
using WorkFlow.Application.Dto.Config;
|
|
||||||
using WorkFlow.Application.Dto.ProfileControlsTF;
|
|
||||||
using WorkFlow.Application.Dto.State;
|
|
||||||
using WorkFlow.Domain.Entities;
|
using WorkFlow.Domain.Entities;
|
||||||
using WorkFlow.Infrastructure.Repositories;
|
using WorkFlow.Infrastructure.Repositories;
|
||||||
|
|
||||||
@ -18,11 +15,11 @@ public static class DependencyInjection
|
|||||||
services.TryAddScoped<IProfileRepository, ProfileRepository>();
|
services.TryAddScoped<IProfileRepository, ProfileRepository>();
|
||||||
services.TryAddScoped<IProfileObjRepository, ProfileObjRepository>();
|
services.TryAddScoped<IProfileObjRepository, ProfileObjRepository>();
|
||||||
|
|
||||||
services.AddDbRepository<WFDBContext, Config>(c => c.Configs).UseAutoMapper(typeof(ConfigUpdateDto));
|
services.AddDbRepository<WFDBContext, Config>(c => c.Configs).UseAutoMapper();
|
||||||
services.AddDbRepository<WFDBContext, ProfileControlsTF>(c => c.ProfileControlsTFs).UseAutoMapper(typeof(ProfileControlsTFUpdateDto));
|
services.AddDbRepository<WFDBContext, ProfileControlsTF>(c => c.ProfileControlsTFs).UseAutoMapper();
|
||||||
services.AddDbRepository<WFDBContext, State>(c => c.States).UseAutoMapper(typeof(StateUpdateDto));
|
services.AddDbRepository<WFDBContext, State>(c => c.States).UseAutoMapper();
|
||||||
services.AddDbRepository<WFDBContext, Button>(c => c.Buttons).UseAutoMapper();
|
services.AddDbRepository<WFDBContext, Button>(c => c.Buttons).UseAutoMapper();
|
||||||
services.AddDbRepository<WFDBContext, State>(c => c.States).UseAutoMapper(typeof(StateUpdateDto));
|
services.AddDbRepository<WFDBContext, State>(c => c.States).UseAutoMapper();
|
||||||
services.AddDbRepository<WFDBContext, ProfileObjState>(c => c.ProfileObjStates).UseAutoMapper();
|
services.AddDbRepository<WFDBContext, ProfileObjState>(c => c.ProfileObjStates).UseAutoMapper();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user