Added missing field in user dto
This commit is contained in:
@@ -7,6 +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; }
|
||||
|
||||
@@ -6,6 +6,7 @@ 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; }
|
||||
}
|
||||
@@ -44,6 +44,13 @@ public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
|
||||
.NotEmpty()
|
||||
.WithMessage("CreationDate is required");
|
||||
|
||||
When(x => x.DesignationId is not null, () =>
|
||||
{
|
||||
RuleFor(x => x.DesignationName)
|
||||
.NotEmpty()
|
||||
.WithMessage("DesignationId is required");
|
||||
});
|
||||
|
||||
When(x => x.DesignationName is not null, () =>
|
||||
{
|
||||
RuleFor(x => x.DesignationName)
|
||||
|
||||
@@ -38,6 +38,13 @@ public class GetUserDtoValidator : Validator<GetUserDto>
|
||||
.MinimumLength(2)
|
||||
.WithMessage("Username must exceed 2 characters");
|
||||
|
||||
When(x => x.DesignationId is not null, () =>
|
||||
{
|
||||
RuleFor(x => x.DesignationName)
|
||||
.NotEmpty()
|
||||
.WithMessage("DesignationId is required");
|
||||
});
|
||||
|
||||
When(x => x.DesignationName is not null, () =>
|
||||
{
|
||||
RuleFor(x => x.DesignationName)
|
||||
|
||||
Reference in New Issue
Block a user