Cleaned code

This commit is contained in:
2026-03-24 18:02:10 +01:00
parent ae8a33b7b6
commit c8cd5d9257
24 changed files with 66 additions and 67 deletions
@@ -19,7 +19,7 @@ public class GetAchievementDtoValidator : Validator<GetAchievementDto>
.WithMessage("Description must contain more than 2 characters")
.MaximumLength(200)
.WithMessage("Description cannot contain more than 200 characters");
RuleFor(x => x.Label)
.NotEmpty()
.WithMessage("Label must be specified")
@@ -13,6 +13,5 @@ public class UnlockAchievementDtoValidator : Validator<UnlockAchievementDto>
.WithMessage("AchievementId cannot be empty")
.GreaterThan(0)
.WithMessage("AchievementId must be greater than 0");
}
}
@@ -4,7 +4,7 @@ using FluentValidation;
namespace BeReadyBackend.Validators.Auth;
public class LoginDtoValidator: Validator<LoginDto>
public class LoginDtoValidator : Validator<LoginDto>
{
public LoginDtoValidator()
{
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Friends;
public class GetFriendDtoValidator : Validator<GetFriendDto>
{
public GetFriendDtoValidator()
public GetFriendDtoValidator()
{
RuleFor(x => x.Username)
.NotEmpty()
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Friends;
public class GetFriendRequestDtoValidator : Validator<GetFriendDto>
{
public GetFriendRequestDtoValidator()
public GetFriendRequestDtoValidator()
{
RuleFor(x => x.Username)
.NotEmpty()
@@ -31,7 +31,7 @@ public class CreateGroupDtoValidator : Validator<CreateGroupDto>
.WithMessage("Description cannot exceed 200 characters")
.MinimumLength(2)
.WithMessage("Description must exceed 2 characters");
RuleFor(x => x.Duration)
.NotEmpty()
.WithMessage("Duration cannot be empty")
@@ -13,7 +13,7 @@ public class GetGroupDetailsDtoValidator : Validator<GetGroupDetailsDto>
.WithMessage("Id cannot be empty")
.GreaterThan(0)
.WithMessage("Id must be greater than zero");
RuleFor(x => x.Label)
.NotEmpty()
.WithMessage("Label cannot be empty")
@@ -41,7 +41,7 @@ public class GetGroupDetailsDtoValidator : Validator<GetGroupDetailsDto>
.WithMessage("Description cannot exceed 50 characters")
.MinimumLength(2)
.WithMessage("Description must exceed 2 characters");
RuleFor(x => x.Duration)
.NotEmpty()
.WithMessage("Duration cannot be empty")
@@ -13,7 +13,7 @@ public class GetGroupDtoValidator : Validator<GetGroupDto>
.WithMessage("Id cannot be empty")
.GreaterThan(0)
.WithMessage("Id must be greater than zero");
RuleFor(x => x.Label)
.NotEmpty()
.WithMessage("Label cannot be empty")
@@ -13,7 +13,7 @@ public class GetProofDtoValidator : Validator<GetProofDto>
.WithMessage("Id cannot be empty")
.GreaterThan(0)
.WithMessage("Id must be greater than 0");
RuleFor(x => x.Username)
.NotEmpty()
.WithMessage("Username cannot be empty")
@@ -25,7 +25,7 @@ public class GetProofDtoValidator : Validator<GetProofDto>
RuleFor(x => x.Proof)
.NotEmpty()
.WithMessage("Proof cannot be empty");
RuleFor(x => x.Score)
.NotEmpty()
.WithMessage("Score cannot be empty");
@@ -13,7 +13,7 @@ public class GetUserGroupDtoValidator : Validator<GetUserGroupDto>
.WithMessage("Id cannot be empty")
.GreaterThan(0)
.WithMessage("Id must be greater than 0");
RuleFor(x => x.Username)
.NotEmpty()
.WithMessage("Username cannot be empty")
@@ -25,7 +25,7 @@ public class GetUserGroupDtoValidator : Validator<GetUserGroupDto>
RuleFor(x => x.Grade)
.NotEmpty()
.WithMessage("Grade cannot be empty");
RuleFor(x => x.Score)
.NotEmpty()
.WithMessage("Score cannot be empty");
@@ -15,7 +15,7 @@ public class GetRandomChallengeDtoValidator : Validator<GetRandomChallengeDto>
.WithMessage("Libelle cannot exceed 200 characters")
.MinimumLength(2)
.WithMessage("Libelle must exceed 2 characters");
RuleFor(x => x.Duration)
.NotEmpty()
.WithMessage("Duration cannot be empty")
@@ -44,7 +44,7 @@ public class CreateUserDtoValidator : Validator<CreateUserDto>
.NotEmpty()
.WithMessage("Password is required")
.MaximumLength(60)
.WithMessage("Password cannot exceed 60 characters")
.WithMessage("Password cannot exceed 60 characters")
.MinimumLength(12)
.WithMessage("Password must exceed 12 characters");
}
@@ -6,14 +6,14 @@ namespace BeReadyBackend.Validators.Users;
public class GetUserChallengeDtoValidator : Validator<GetUserChallengeDto>
{
public GetUserChallengeDtoValidator()
public GetUserChallengeDtoValidator()
{
RuleFor(x => x.ChallengeTitle)
.NotEmpty()
.WithMessage("Challenge Title is required")
.MaximumLength(200)
.WithMessage("Challenge Title cannot exceed 200 characters");
RuleFor(x => x.ChallengeDescription)
.NotEmpty()
.WithMessage("Challenge Description is required")
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Users;
public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
{
public GetUserDetailsDtoValidator()
public GetUserDetailsDtoValidator()
{
RuleFor(x => x.FirstName)
.NotEmpty()
@@ -15,7 +15,7 @@ public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
.WithMessage("First name cannot not exceed 50 characters")
.MinimumLength(50)
.WithMessage("First name must not exceed 50 characters");
RuleFor(x => x.Name)
.NotEmpty()
.WithMessage("Name is required")
@@ -43,7 +43,7 @@ public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
RuleFor(x => x.CreationDate)
.NotEmpty()
.WithMessage("CreationDate is required");
When(x => x.DesignationId is not null, () =>
{
RuleFor(x => x.DesignationId)
@@ -6,14 +6,14 @@ namespace BeReadyBackend.Validators.Users;
public class GetUserDtoValidator : Validator<GetUserDto>
{
public GetUserDtoValidator() {
public GetUserDtoValidator()
{
RuleFor(x => x.Id)
.NotEmpty()
.WithMessage("Id cannot be empty")
.GreaterThan(0)
.WithMessage("Id must be greater than 0");
RuleFor(x => x.FirstName)
.NotEmpty()
.WithMessage("First name is required")
@@ -37,7 +37,7 @@ public class GetUserDtoValidator : Validator<GetUserDto>
.WithMessage("Username cannot exceed 50 characters")
.MinimumLength(2)
.WithMessage("Username must exceed 2 characters");
When(x => x.DesignationId is not null, () =>
{
RuleFor(x => x.DesignationId)
@@ -13,7 +13,7 @@ public class GetUserProofDtoValidator : Validator<GetUserProofDto>
.WithMessage("Id cannot be empty")
.GreaterThan(0)
.WithMessage("Id must be greater than 0");
RuleFor(x => x.Proof)
.NotEmpty()
.WithMessage("Proof cannot be empty");
@@ -6,30 +6,30 @@ namespace BeReadyBackend.Validators.Users;
public class GetUserStatsDtoValidator : Validator<GetUserStatsDto>
{
public GetUserStatsDtoValidator()
{
RuleFor(x => x.Score)
.NotEmpty()
.WithMessage("Score is required");
RuleFor(x => x.TotalWin)
.NotEmpty()
.WithMessage("Total win is required");
RuleFor(x=> x.TotalChallenge)
.NotEmpty()
.WithMessage("Total challenge is required");
RuleFor(x => x.TotalPodium)
.NotEmpty()
.WithMessage("Total podium is required");
RuleFor(x => x.TotalBonusChallenge)
.NotEmpty()
.WithMessage("Total bonus is required");
RuleFor(x => x.Series)
.NotEmpty()
.WithMessage("Series is required");
}
public GetUserStatsDtoValidator()
{
RuleFor(x => x.Score)
.NotEmpty()
.WithMessage("Score is required");
RuleFor(x => x.TotalWin)
.NotEmpty()
.WithMessage("Total win is required");
RuleFor(x => x.TotalChallenge)
.NotEmpty()
.WithMessage("Total challenge is required");
RuleFor(x => x.TotalPodium)
.NotEmpty()
.WithMessage("Total podium is required");
RuleFor(x => x.TotalBonusChallenge)
.NotEmpty()
.WithMessage("Total bonus is required");
RuleFor(x => x.Series)
.NotEmpty()
.WithMessage("Series is required");
}
}
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Users;
public class UpdateUserDtoValidator : Validator<UpdateUserDto>
{
public UpdateUserDtoValidator()
public UpdateUserDtoValidator()
{
RuleFor(x => x.FirstName)
.NotEmpty()
@@ -23,7 +23,7 @@ public class UpdateUserDtoValidator : Validator<UpdateUserDto>
.WithMessage("Name cannot exceed 50 characters")
.MinimumLength(2)
.WithMessage("Name must exceed 2 characters");
RuleFor(x => x.Username)
.NotEmpty()
.WithMessage("Username is required")