Cleaned code
This commit is contained in:
@@ -15,7 +15,7 @@ public class CreateAuthorDtoValidator : Validator<CreateAuthorDto>
|
||||
.WithMessage("First name cannot exceed 100 characters.")
|
||||
.MinimumLength(2)
|
||||
.WithMessage("First name must exceed 2 characters.");
|
||||
|
||||
|
||||
RuleFor(x => x.LastName)
|
||||
.NotEmpty()
|
||||
.WithMessage("Last name is required.")
|
||||
@@ -23,19 +23,19 @@ public class CreateAuthorDtoValidator : Validator<CreateAuthorDto>
|
||||
.WithMessage("Last name cannot exceed 100 characters.")
|
||||
.MinimumLength(2)
|
||||
.WithMessage("Last name must exceed 2 characters.");
|
||||
|
||||
|
||||
RuleFor(x => x.Biography)
|
||||
.MaximumLength(2000)
|
||||
.WithMessage("Biography cannot exceed 2000 characters.")
|
||||
.MinimumLength(2)
|
||||
.WithMessage("Biography must exceed 2 characters.");
|
||||
|
||||
|
||||
RuleFor(x => x.BirthDate)
|
||||
.NotEmpty()
|
||||
.WithMessage("Birth date is required.")
|
||||
.LessThan(DateOnly.FromDateTime(DateTime.Now))
|
||||
.WithMessage("Birth date cannot be in the future.");
|
||||
|
||||
|
||||
RuleFor(x => x.Nationality)
|
||||
.NotEmpty()
|
||||
.WithMessage("Nationality is required.")
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GetAuthorDtoValidator : Validator<GetAuthorDto>
|
||||
RuleFor(x => x.FirstName)
|
||||
.NotEmpty()
|
||||
.WithMessage("First name is required");
|
||||
|
||||
|
||||
RuleFor(x => x.LastName)
|
||||
.NotEmpty()
|
||||
.WithMessage("Last name is required");
|
||||
|
||||
@@ -11,7 +11,7 @@ public class UpdateAuthorDtoValidator : Validator<UpdateAuthorDto>
|
||||
RuleFor(x => x.Id)
|
||||
.GreaterThan(0)
|
||||
.WithMessage("Id is invalid.");
|
||||
|
||||
|
||||
RuleFor(x => x.FirstName)
|
||||
.NotEmpty()
|
||||
.WithMessage("First name is required.")
|
||||
@@ -19,7 +19,7 @@ public class UpdateAuthorDtoValidator : Validator<UpdateAuthorDto>
|
||||
.WithMessage("First name cannot exceed 100 characters.")
|
||||
.MinimumLength(2)
|
||||
.WithMessage("First name must exceed 2 characters.");
|
||||
|
||||
|
||||
RuleFor(x => x.LastName)
|
||||
.NotEmpty()
|
||||
.WithMessage("Last name is required.")
|
||||
@@ -27,19 +27,19 @@ public class UpdateAuthorDtoValidator : Validator<UpdateAuthorDto>
|
||||
.WithMessage("Last name cannot exceed 100 characters.")
|
||||
.MinimumLength(2)
|
||||
.WithMessage("Last name must exceed 2 characters.");
|
||||
|
||||
|
||||
RuleFor(x => x.Biography)
|
||||
.MaximumLength(2000)
|
||||
.WithMessage("Biography cannot exceed 2000 characters.")
|
||||
.MinimumLength(2)
|
||||
.WithMessage("Biography must exceed 2 characters.");
|
||||
|
||||
|
||||
RuleFor(x => x.BirthDate)
|
||||
.NotEmpty()
|
||||
.WithMessage("Birth date is required.")
|
||||
.LessThan(DateOnly.FromDateTime(DateTime.Now))
|
||||
.WithMessage("Birth date cannot be in the future.");
|
||||
|
||||
|
||||
RuleFor(x => x.Nationality)
|
||||
.NotEmpty()
|
||||
.WithMessage("Nationality is required.")
|
||||
|
||||
Reference in New Issue
Block a user