16 lines
643 B
C#
16 lines
643 B
C#
using FluentValidation;
|
|
|
|
namespace Indotalent.Features.Leave.LeaveBalance.Cqrs;
|
|
|
|
public class CreateLeaveBalanceValidator : AbstractValidator<CreateLeaveBalanceRequest>
|
|
{
|
|
public CreateLeaveBalanceValidator()
|
|
{
|
|
RuleFor(x => x.EmployeeId).NotEmpty().WithMessage("Employee is required");
|
|
RuleFor(x => x.LeaveCategoryId).NotEmpty().WithMessage("Leave Category is required");
|
|
RuleFor(x => x.Year).GreaterThan(2000);
|
|
RuleFor(x => x.Entitlement).GreaterThanOrEqualTo(0);
|
|
RuleFor(x => x.ValidFrom).NotEmpty();
|
|
RuleFor(x => x.ValidTo).NotEmpty().GreaterThanOrEqualTo(x => x.ValidFrom);
|
|
}
|
|
} |