Spaces:
Runtime error
Runtime error
File size: 888 Bytes
de8b914 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | using FluentValidation;
using SCM.Application.Projects.Dtos;
namespace SCM.Application.Projects.Validators;
public sealed class UpdateProjectRequestValidator : AbstractValidator<UpdateProjectRequest>
{
public UpdateProjectRequestValidator()
{
RuleFor(x => x.Name)
.NotEmpty().WithMessage("O nome da obra é obrigatório.")
.MaximumLength(200);
RuleFor(x => x.Description)
.MaximumLength(2000);
RuleFor(x => x.StartDate)
.NotEmpty().WithMessage("A data de início é obrigatória.");
RuleFor(x => x.EndDate)
.GreaterThanOrEqualTo(x => x.StartDate)
.When(x => x.EndDate.HasValue)
.WithMessage("A data de término não pode ser anterior à data de início.");
RuleFor(x => x.Status)
.IsInEnum().WithMessage("Situação inválida.");
}
}
|