2025-08-09 18:09:17 +02:00

25 lines
896 B
C#

using FluentValidation;
using Liber_Incantamentum.Application.DTOs.Spell;
namespace Liber_Incantamentum.Application.Services.Validations
{
public class SpellDtoValidator : AbstractValidator<SpellDto>
{
public SpellDtoValidator()
{
RuleFor(m => m.Id)
.NotEmpty().WithMessage("The Id cannot be empty");
RuleFor(m => m.Name)
.NotEmpty().WithMessage("The Name cannot be empty");
RuleFor(m => m.Description)
.NotEmpty().WithMessage("The Description cannot be empty");
RuleFor(m => m.Type)
.NotEmpty().WithMessage("The Type cannot be empty");
RuleFor(m => m.CreationDate)
.LessThanOrEqualTo(DateTime.UtcNow);
RuleFor(m => m.MageId)
.NotEmpty().WithMessage("The mage id cannot be empty");
}
}
}