28 lines
967 B
C#
28 lines
967 B
C#
using FluentValidation;
|
|
using Indotalent.Shared.Consts;
|
|
|
|
namespace Indotalent.Features.Payroll.Grade.Cqrs;
|
|
|
|
public class CreateGradeValidator : AbstractValidator<CreateGradeRequest>
|
|
{
|
|
public CreateGradeValidator()
|
|
{
|
|
RuleFor(x => x.Code)
|
|
.NotEmpty().WithMessage("Grade Code is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort);
|
|
|
|
RuleFor(x => x.Name)
|
|
.NotEmpty().WithMessage("Grade Name is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort);
|
|
|
|
RuleFor(x => x.SalaryFrom)
|
|
.GreaterThanOrEqualTo(0).WithMessage("Salary From must be 0 or greater");
|
|
|
|
RuleFor(x => x.SalaryTo)
|
|
.GreaterThanOrEqualTo(x => x.SalaryFrom).WithMessage("Salary To must be greater than or equal to Salary From");
|
|
|
|
RuleFor(x => x.Status)
|
|
.NotEmpty().WithMessage("Status is required")
|
|
.MaximumLength(GlobalConsts.StringLengthShort);
|
|
}
|
|
} |