Added Designation Name into userInfo
This commit is contained in:
@@ -7,7 +7,7 @@ public class GetUserDetailsDto
|
||||
public string? Name { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public int? DesignationId { get; set; }
|
||||
public string? DesignationName { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public GetUserStatsDto? GetUserStatsDto { get; set; }
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class EntityToDtoMappings : Profile
|
||||
.ForMember(dest => dest.DesignationName, opt => opt.MapFrom(src => src.Designation!.Label));
|
||||
|
||||
CreateMap<User, GetUserDetailsDto>()
|
||||
.ForMember(dest => dest.DesignationName, opt => opt.MapFrom(src => src.Designation!.Label))
|
||||
.ForMember(dest => dest.GetUserStatsDto, opt => opt.MapFrom(src => src));
|
||||
|
||||
CreateMap<User, GetUserStatsDto>();
|
||||
|
||||
@@ -44,9 +44,9 @@ public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
|
||||
.NotEmpty()
|
||||
.WithMessage("CreationDate is required");
|
||||
|
||||
When(x => x.DesignationId is not null, () =>
|
||||
When(x => x.DesignationName is not null, () =>
|
||||
{
|
||||
RuleFor(x => x.DesignationId)
|
||||
RuleFor(x => x.DesignationName)
|
||||
.NotEmpty()
|
||||
.WithMessage("DesignationId is required");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user