Initial commit

This commit is contained in:
2026-05-05 10:39:43 +02:00
commit b590ecdc35
87 changed files with 3934 additions and 0 deletions
@@ -0,0 +1,28 @@
using FastEndpoints;
using FluentValidation;
using MetaCourse.Api.DTOs.Topics;
namespace MetaCourse.Api.Validators.Topics;
public class UpdateTopicDtoValidator : Validator<UpdateTopicDto>
{
public UpdateTopicDtoValidator()
{
RuleFor(x => x.Id)
.NotEqual(Guid.Empty).WithMessage("L'identifiant est invalide.");
RuleFor(x => x.Title)
.NotEmpty().WithMessage("Le titre est requis.")
.MinimumLength(2).WithMessage("Le titre doit contenir au moins 2 caractères.")
.MaximumLength(200).WithMessage("Le titre ne peut pas dépasser 200 caractères.");
When(x => x.Description != null, () =>
{
RuleFor(x => x.Description)
.MaximumLength(1000).WithMessage("La description ne peut pas dépasser 1000 caractères.");
});
RuleFor(x => x.Position)
.GreaterThan(0).WithMessage("La position doit être supérieure à 0.");
}
}