27 lines
728 B
C#
27 lines
728 B
C#
using FastEndpoints;
|
|
using FluentValidation;
|
|
using Knots.DTO.User;
|
|
|
|
namespace Knots.Validators.User;
|
|
|
|
public class UpdateUserContactDtoValidator : Validator<UpdateUserContactDto>
|
|
{
|
|
public UpdateUserContactDtoValidator()
|
|
{
|
|
RuleFor(x => x.Id)
|
|
.NotEmpty()
|
|
.WithMessage("L'id est requis")
|
|
.GreaterThan(0)
|
|
.WithMessage("L'id doit être supérieur à 0");
|
|
|
|
RuleFor(x => x.Email)
|
|
.NotEmpty()
|
|
.WithMessage("L'email est requis")
|
|
.EmailAddress()
|
|
.WithMessage("Ce n'est pas un email valide");
|
|
|
|
RuleFor(x => x.Tel)
|
|
.NotEmpty()
|
|
.WithMessage("Le numéro de téléphone est requis");
|
|
}
|
|
} |