Initial commit

This commit is contained in:
Kevin Harlay
2026-09-07 13:33:22 +02:00
commit ebfaf6f5ec
295 changed files with 8786 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
using ExpenseTracker.Api.DTOs;
using FluentValidation;
namespace ExpenseTracker.Api.Validators;
public class CreateEntryDtoValidator : AbstractValidator<CreateEntryDto>
{
public CreateEntryDtoValidator()
{
RuleFor(x => x.Type)
.NotEmpty()
.WithMessage("Type is required.")
.Must(t => t == "INCOME" || t == "EXPENSE")
.WithMessage("Type must be INCOME or EXPENSE.");
RuleFor(x => x.Amount)
.GreaterThan(0)
.WithMessage("Amount must be greater than 0.");
RuleFor(x => x.Label)
.NotEmpty()
.WithMessage("Label is required.")
.MaximumLength(200)
.WithMessage("Label must not exceed 200 characters.");
RuleFor(x => x.EntryDate)
.NotEqual(default(DateOnly))
.WithMessage("EntryDate is required.");
RuleFor(x => x.CategoryId)
.NotNull()
.WithMessage("CategoryId is required for EXPENSE entries.")
.When(x => x.Type == "EXPENSE");
}
}