From 1fff5f816f90052b91be6e660ee5119b890abc7a Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Thu, 14 May 2026 11:48:20 +0100 Subject: [PATCH] Cleaned code --- BeReadyBackend/Endpoints/Posts/GetAllPostsEndpoint.cs | 3 ++- .../Endpoints/RandomChallenges/PatchProofEndpoint.cs | 2 +- BeReadyBackend/Endpoints/Users/GetAllUserProofsEndpoint.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BeReadyBackend/Endpoints/Posts/GetAllPostsEndpoint.cs b/BeReadyBackend/Endpoints/Posts/GetAllPostsEndpoint.cs index 859f032..520549e 100644 --- a/BeReadyBackend/Endpoints/Posts/GetAllPostsEndpoint.cs +++ b/BeReadyBackend/Endpoints/Posts/GetAllPostsEndpoint.cs @@ -28,7 +28,8 @@ public class GetAllPostsEndpoint(PostsRepository postsRepository, UserService us Likes = x.Likes, Proof = x.User?.UserRandomChallenges? .SingleOrDefault(u => - u.RandomChallenge?.GeneratedAt is not null && DateOnly.FromDateTime(u.RandomChallenge.GeneratedAt.Value) == DateOnly.FromDateTime(x.CreationDate)) + u.RandomChallenge?.GeneratedAt is not null + && DateOnly.FromDateTime(u.RandomChallenge.GeneratedAt.Value) == DateOnly.FromDateTime(x.CreationDate)) ?.Proof, UserId = x.UserId, Username = x.User?.Username, diff --git a/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs b/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs index 92498af..e0b627e 100644 --- a/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs +++ b/BeReadyBackend/Endpoints/RandomChallenges/PatchProofEndpoint.cs @@ -88,7 +88,7 @@ public class PatchProofEndpoint( Libelle = "test pour le moment", UserId = userId }; - + await postsRepository.AddAsync(post, ct); await Send.NoContentAsync(ct); } diff --git a/BeReadyBackend/Endpoints/Users/GetAllUserProofsEndpoint.cs b/BeReadyBackend/Endpoints/Users/GetAllUserProofsEndpoint.cs index 4a58065..ffcf34f 100644 --- a/BeReadyBackend/Endpoints/Users/GetAllUserProofsEndpoint.cs +++ b/BeReadyBackend/Endpoints/Users/GetAllUserProofsEndpoint.cs @@ -25,7 +25,7 @@ public class GetAllUserProofsEndpoint(UsersRepository usersRepository, UserServi await Send.NotFoundAsync(ct); return; } - + List proofs = user.UserRandomChallenges? .Where(x => x.Proof is not null) .Select(x => new GetUserProofDto