Initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using ExpenseTracker.Api.DTOs;
|
||||
using FluentValidation;
|
||||
|
||||
namespace ExpenseTracker.Api.Validators;
|
||||
|
||||
public class CreateMonthDtoValidator : AbstractValidator<CreateMonthDto>
|
||||
{
|
||||
public CreateMonthDtoValidator()
|
||||
{
|
||||
RuleFor(x => x.Year)
|
||||
.GreaterThanOrEqualTo(2000)
|
||||
.WithMessage("Year must be 2000 or later.");
|
||||
|
||||
RuleFor(x => x.Month)
|
||||
.InclusiveBetween(1, 12)
|
||||
.WithMessage("Month must be between 1 and 12.");
|
||||
|
||||
RuleFor(x => x.DefaultSalary)
|
||||
.GreaterThanOrEqualTo(0)
|
||||
.WithMessage("DefaultSalary must be zero or positive.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user