initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Indotalent.Features.Leave.LeaveRequest.Cqrs;
|
||||
|
||||
public class UpdateLeaveRequestValidator : AbstractValidator<UpdateLeaveRequestRequest>
|
||||
{
|
||||
public UpdateLeaveRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.Id)
|
||||
.NotEmpty().WithMessage("ID is required for update");
|
||||
|
||||
RuleFor(x => x.EmployeeId)
|
||||
.NotEmpty().WithMessage("Employee is required");
|
||||
|
||||
RuleFor(x => x.LeaveCategoryId)
|
||||
.NotEmpty().WithMessage("Leave Type is required");
|
||||
|
||||
RuleFor(x => x.StartDate)
|
||||
.NotEmpty().WithMessage("Start Date is required");
|
||||
|
||||
RuleFor(x => x.EndDate)
|
||||
.NotEmpty()
|
||||
.GreaterThanOrEqualTo(x => x.StartDate).WithMessage("End Date cannot be before Start Date");
|
||||
|
||||
RuleFor(x => x.Reason)
|
||||
.NotEmpty().WithMessage("Reason is required");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user