Added Designation Name into userInfo

This commit is contained in:
2026-04-14 14:58:34 +01:00
parent 0cae4924cb
commit f80a9489c1
3 changed files with 4 additions and 3 deletions
@@ -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");
});