31 lines
962 B
C#
31 lines
962 B
C#
using FluentValidation;
|
|
using Liber_Incantamentum.Application.DTOs.Mage;
|
|
|
|
namespace Liber_Incantamentum.Application.Services.Validations
|
|
{
|
|
public class MageDtoValidator : AbstractValidator<MageDto>
|
|
{
|
|
public MageDtoValidator()
|
|
{
|
|
RuleFor(m => m.Id)
|
|
.NotEmpty().WithMessage("The Id is required");
|
|
|
|
RuleFor(m => m.Name)
|
|
.NotEmpty().WithMessage("The Name is required");
|
|
|
|
RuleFor(m => m.Rank)
|
|
.NotEmpty().WithMessage("The Rank is required");
|
|
|
|
RuleFor(m => m.Specialisation)
|
|
.NotEmpty().WithMessage("The Specialisation is required");
|
|
|
|
RuleFor(m => m.Spells)
|
|
.NotNull().WithMessage("Spell collection is required")
|
|
.NotEmpty().WithMessage("At least one spell is required");
|
|
|
|
RuleForEach(m => m.Spells)
|
|
.SetValidator(new SpellDtoValidator());
|
|
}
|
|
}
|
|
}
|