diff --git a/BeReadyBackend/DTO/Users/GetUserDto.cs b/BeReadyBackend/DTO/Users/GetUserDto.cs index 4345b58..cf58f8c 100644 --- a/BeReadyBackend/DTO/Users/GetUserDto.cs +++ b/BeReadyBackend/DTO/Users/GetUserDto.cs @@ -6,6 +6,6 @@ public class GetUserDto public string? FirstName { get; set; } public string? Name { get; set; } public string? Username { get; set; } - public int? DesignationId { get; set; } + public string? DesignationName { get; set; } public GetUserStatsDto? GetUserStatsDto { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs b/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs index 0b623a8..1303c89 100644 --- a/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs +++ b/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs @@ -22,7 +22,8 @@ public class EntityToDtoMappings : Profile .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Achievement!.Description)); CreateMap() - .ForMember(dest => dest.GetUserStatsDto, opt => opt.MapFrom(src => src)); + .ForMember(dest => dest.GetUserStatsDto, opt => opt.MapFrom(src => src)) + .ForMember(dest => dest.DesignationName, opt => opt.MapFrom(src => src.Designation!.Label)); CreateMap() .ForMember(dest => dest.GetUserStatsDto, opt => opt.MapFrom(src => src)); diff --git a/BeReadyBackend/Specifications/Users/GetUserByIdSpec.cs b/BeReadyBackend/Specifications/Users/GetUserByIdSpec.cs index dce4a91..97e4361 100644 --- a/BeReadyBackend/Specifications/Users/GetUserByIdSpec.cs +++ b/BeReadyBackend/Specifications/Users/GetUserByIdSpec.cs @@ -8,6 +8,7 @@ public class GetUserByIdSpec : SingleResultSpecification public GetUserByIdSpec(int userId) { Query + .Include(x => x.Designation) .Where(x => x.Id == userId); } } \ No newline at end of file diff --git a/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs b/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs index f0a5950..80988fd 100644 --- a/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs +++ b/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs @@ -38,9 +38,9 @@ public class GetUserDtoValidator : Validator .MinimumLength(2) .WithMessage("Username must exceed 2 characters"); - 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"); });