initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user