From 0edf6c11a1cbcb6c0a465a3f5d0f2d989dc1b7bb Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Tue, 21 Apr 2026 22:05:51 +0100 Subject: [PATCH] Cleaned code --- BeReadyBackend/DTO/Posts/GetPostDto.cs | 2 +- BeReadyBackend/DTO/Users/GetUserProofDto.cs | 2 +- .../Endpoints/RandomChallenges/PatchProofEndpoint.cs | 2 +- BeReadyBackend/MappingProfiles/DtoToEntityMappings.cs | 2 +- BeReadyBackend/Models/Post.cs | 2 +- BeReadyBackend/Models/UserGroup.cs | 2 +- BeReadyBackend/Models/UserPost.cs | 2 +- BeReadyBackend/Specifications/Posts/GetPostNotMeSpec.cs | 2 +- BeReadyBackend/Validators/Posts/GetPostDtoValidator.cs | 8 ++++---- .../RandomChallenges/GetRandomChallengeDtoValidator.cs | 2 +- .../Validators/Users/GetUserDetailsDtoValidator.cs | 2 +- BeReadyBackend/Validators/Users/GetUserDtoValidator.cs | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/BeReadyBackend/DTO/Posts/GetPostDto.cs b/BeReadyBackend/DTO/Posts/GetPostDto.cs index 7dd11da..74f3f73 100644 --- a/BeReadyBackend/DTO/Posts/GetPostDto.cs +++ b/BeReadyBackend/DTO/Posts/GetPostDto.cs @@ -7,7 +7,7 @@ public class GetPostDto public DateTime CreationDate { get; set; } public int Likes { get; set; } public bool IsLiked { get; set; } - + public int UserId { get; set; } public string? Username { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/DTO/Users/GetUserProofDto.cs b/BeReadyBackend/DTO/Users/GetUserProofDto.cs index 21d938b..cfb5e8e 100644 --- a/BeReadyBackend/DTO/Users/GetUserProofDto.cs +++ b/BeReadyBackend/DTO/Users/GetUserProofDto.cs @@ -1,6 +1,6 @@ namespace BeReadyBackend.DTO.Users; public class GetUserProofDto -{ +{ public string? Proof { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs b/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs index a7d7903..8d1a0f2 100644 --- a/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs +++ b/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs @@ -76,7 +76,7 @@ public class PatchProofEndpoint( userRandomChallenge.Proof = Convert.ToBase64String(proofBytes); - user.TotalChallenge++; // +1 challenge bonus de fait + user.TotalChallenge++; // +1 challenge de fait await usersRepository.SaveChangesAsync(ct); await userRandomChallengesRepository.SaveChangesAsync(ct); diff --git a/BeReadyBackend/MappingProfiles/DtoToEntityMappings.cs b/BeReadyBackend/MappingProfiles/DtoToEntityMappings.cs index f2780be..e80e927 100644 --- a/BeReadyBackend/MappingProfiles/DtoToEntityMappings.cs +++ b/BeReadyBackend/MappingProfiles/DtoToEntityMappings.cs @@ -18,7 +18,7 @@ public class DtoToEntityMappings : Profile CreateMap(); CreateMap(); CreateMap(); - + CreateMap(); CreateMap() diff --git a/BeReadyBackend/Models/Post.cs b/BeReadyBackend/Models/Post.cs index 595b1a9..75679d1 100644 --- a/BeReadyBackend/Models/Post.cs +++ b/BeReadyBackend/Models/Post.cs @@ -11,6 +11,6 @@ public class Post public User? User { get; set; } [Required] public int UserId { get; set; } - + public List? UserPosts { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Models/UserGroup.cs b/BeReadyBackend/Models/UserGroup.cs index acc103a..7da6ca8 100644 --- a/BeReadyBackend/Models/UserGroup.cs +++ b/BeReadyBackend/Models/UserGroup.cs @@ -11,6 +11,6 @@ public class UserGroup public Group? Group { get; set; } [Required] public int GroupId { get; set; } - + [Required] public string? Grade { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Models/UserPost.cs b/BeReadyBackend/Models/UserPost.cs index aa36fe1..f647c91 100644 --- a/BeReadyBackend/Models/UserPost.cs +++ b/BeReadyBackend/Models/UserPost.cs @@ -8,7 +8,7 @@ public class UserPost { public User? User { get; set; } [Required] public int UserId { get; set; } - + public Post? Post { get; set; } [Required] public int PostId { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Specifications/Posts/GetPostNotMeSpec.cs b/BeReadyBackend/Specifications/Posts/GetPostNotMeSpec.cs index 3aac12c..e55742e 100644 --- a/BeReadyBackend/Specifications/Posts/GetPostNotMeSpec.cs +++ b/BeReadyBackend/Specifications/Posts/GetPostNotMeSpec.cs @@ -11,7 +11,7 @@ public class GetPostNotMeSpec : Specification .Include(x => x.User) .Include(x => x.UserPosts!) .ThenInclude(up => up.User) - .Where(x => x.UserId != userId && + .Where(x => x.UserId != userId && x.CreationDate >= DateTime.Today && x.CreationDate < DateTime.Today.AddDays(1)); } } \ No newline at end of file diff --git a/BeReadyBackend/Validators/Posts/GetPostDtoValidator.cs b/BeReadyBackend/Validators/Posts/GetPostDtoValidator.cs index f17e556..314b259 100644 --- a/BeReadyBackend/Validators/Posts/GetPostDtoValidator.cs +++ b/BeReadyBackend/Validators/Posts/GetPostDtoValidator.cs @@ -21,21 +21,21 @@ public class GetPostDtoValidator : Validator .WithMessage("Libelle cannot exceed 100 characters") .MinimumLength(2) .WithMessage("Libelle must exceed 2 characters"); - + RuleFor(x => x.CreationDate) .NotEmpty() .WithMessage("CreationDate cannot be empty"); - + RuleFor(x => x.Likes) .NotEmpty() .WithMessage("Likes cannot be empty"); - + RuleFor(x => x.UserId) .NotEmpty() .WithMessage("UserId cannot be empty") .GreaterThan(0) .WithMessage("UserId must be greater than zero"); - + RuleFor(x => x.Username) .NotEmpty() .WithMessage("UserUsername cannot be empty"); diff --git a/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs b/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs index 3d6ef4a..29a9bcc 100644 --- a/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs +++ b/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs @@ -15,7 +15,7 @@ public class GetRandomChallengeDtoValidator : Validator .WithMessage("Label cannot exceed 200 characters") .MinimumLength(2) .WithMessage("Label must exceed 2 characters"); - + RuleFor(x => x.Libelle) .NotEmpty() .WithMessage("Libelle is required") diff --git a/BeReadyBackend/Validators/Users/GetUserDetailsDtoValidator.cs b/BeReadyBackend/Validators/Users/GetUserDetailsDtoValidator.cs index 1d6f551..e90b749 100644 --- a/BeReadyBackend/Validators/Users/GetUserDetailsDtoValidator.cs +++ b/BeReadyBackend/Validators/Users/GetUserDetailsDtoValidator.cs @@ -50,7 +50,7 @@ public class GetUserDetailsDtoValidator : Validator .NotEmpty() .WithMessage("DesignationId is required"); }); - + When(x => x.DesignationName is not null, () => { RuleFor(x => x.DesignationName) diff --git a/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs b/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs index 74e91f5..d7c71e4 100644 --- a/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs +++ b/BeReadyBackend/Validators/Users/GetUserDtoValidator.cs @@ -44,7 +44,7 @@ public class GetUserDtoValidator : Validator .NotEmpty() .WithMessage("DesignationId is required"); }); - + When(x => x.DesignationName is not null, () => { RuleFor(x => x.DesignationName)