Files
ExpenseTrackerApi/Validators/CreateMonthDtoValidator.cs
Kevin Harlay ebfaf6f5ec Initial commit
2026-09-07 13:33:22 +02:00

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.");
}
}