Validator update

This commit is contained in:
2026-03-19 15:09:54 +01:00
parent 3a83372403
commit 50227abc26
8 changed files with 60 additions and 12 deletions

View File

@@ -2,5 +2,5 @@ namespace Knots.DTO.Role;
public class GetRoleDto public class GetRoleDto
{ {
public string? Id { get; set; } public string? Libelle { get; set; }
} }

View File

@@ -1,6 +1,23 @@
using FastEndpoints;
using FluentValidation;
using Knots.DTO.Message;
namespace Knots.Validators.Message; namespace Knots.Validators.Message;
public class CreateMessageDtoValidator public class CreateMessageDtoValidator : Validator<CreateMessageDto>
{ {
public CreateMessageDtoValidator()
{
RuleFor(x => x.Contenu)
.NotEmpty()
.WithMessage("Le message ne peux pas être vide")
.MaximumLength(1000)
.WithMessage("Le message ne doit pas faire plus de 1000 caractères");
RuleFor(x => x.Date)
.NotEmpty()
.WithMessage("La date ne peut pas être vide");
}
} }

View File

@@ -1,6 +1,17 @@
using FastEndpoints;
using FluentValidation;
using Knots.DTO.Role;
namespace Knots.Validators.Role; namespace Knots.Validators.Role;
public class CreateRoleDtoValidator public class CreateRoleDtoValidator : Validator<CreateRoleDto>
{ {
public CreateRoleDtoValidator()
{
RuleFor(x => x.Libelle)
.NotEmpty()
.WithMessage("Libelle cannot be empty")
.MaximumLength(50)
.WithMessage("Libelle maximum length is 50");
}
} }

View File

@@ -1,6 +1,15 @@
using FastEndpoints;
using FluentValidation;
using Knots.DTO.Role;
namespace Knots.Validators.Role; namespace Knots.Validators.Role;
public class DeleteRoleDtoValidator public class DeleteRoleDtoValidator : Validator<DeleteRoleDto>
{ {
public DeleteRoleDtoValidator()
{
RuleFor(x => x.Id)
.NotEmpty()
.WithMessage("Id cannot be empty");
}
} }

View File

@@ -1,6 +1,17 @@
using FastEndpoints;
using FluentValidation;
using Knots.DTO.Role;
namespace Knots.Validators.Role; namespace Knots.Validators.Role;
public class GetRoleDtoValidator public class GetRoleDtoValidator : Validator<GetRoleDto>
{ {
public GetRoleDtoValidator()
{
RuleFor(x => x.Libelle)
.NotEmpty()
.WithMessage("Libelle cannot be empty")
.MaximumLength(50)
.WithMessage("Libelle maximum length is 50");
}
} }

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Knots")] [assembly: System.Reflection.AssemblyCompanyAttribute("Knots")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+db76d50079bd8ba155bd61dd1e6de2e36e26ec1b")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3a833724031a4e7076b11dcb48bd7aa2c7376432")]
[assembly: System.Reflection.AssemblyProductAttribute("Knots")] [assembly: System.Reflection.AssemblyProductAttribute("Knots")]
[assembly: System.Reflection.AssemblyTitleAttribute("Knots")] [assembly: System.Reflection.AssemblyTitleAttribute("Knots")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
779fa9ee144195dcfe3057aa46e3c8c1c55ddffa9229c6d8635ec11d69b98c0b ea906d69ee00ac134acfca751c691f6f874ba5373dc51f1200fce206bc66abe5

View File

@@ -1 +1 @@
17733306544048221 17733307741808199