23 lines
624 B
C#
23 lines
624 B
C#
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.");
|
|
}
|
|
}
|