Cleaned code

This commit is contained in:
2026-04-21 22:05:51 +01:00
parent 881f8559c1
commit 0edf6c11a1
12 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ public class GetPostDto
public DateTime CreationDate { get; set; } public DateTime CreationDate { get; set; }
public int Likes { get; set; } public int Likes { get; set; }
public bool IsLiked { get; set; } public bool IsLiked { get; set; }
public int UserId { get; set; } public int UserId { get; set; }
public string? Username { get; set; } public string? Username { get; set; }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
namespace BeReadyBackend.DTO.Users; namespace BeReadyBackend.DTO.Users;
public class GetUserProofDto public class GetUserProofDto
{ {
public string? Proof { get; set; } public string? Proof { get; set; }
} }
@@ -76,7 +76,7 @@ public class PatchProofEndpoint(
userRandomChallenge.Proof = Convert.ToBase64String(proofBytes); userRandomChallenge.Proof = Convert.ToBase64String(proofBytes);
user.TotalChallenge++; // +1 challenge bonus de fait user.TotalChallenge++; // +1 challenge de fait
await usersRepository.SaveChangesAsync(ct); await usersRepository.SaveChangesAsync(ct);
await userRandomChallengesRepository.SaveChangesAsync(ct); await userRandomChallengesRepository.SaveChangesAsync(ct);
@@ -18,7 +18,7 @@ public class DtoToEntityMappings : Profile
CreateMap<CreateUserDto, User>(); CreateMap<CreateUserDto, User>();
CreateMap<UpdateUserDto, User>(); CreateMap<UpdateUserDto, User>();
CreateMap<PatchUserDesignationDto, User>(); CreateMap<PatchUserDesignationDto, User>();
CreateMap<SendFriendDto, UserFriend>(); CreateMap<SendFriendDto, UserFriend>();
CreateMap<CreateGroupDto, Group>() CreateMap<CreateGroupDto, Group>()
+1 -1
View File
@@ -11,6 +11,6 @@ public class Post
public User? User { get; set; } public User? User { get; set; }
[Required] public int UserId { get; set; } [Required] public int UserId { get; set; }
public List<UserPost>? UserPosts { get; set; } public List<UserPost>? UserPosts { get; set; }
} }
+1 -1
View File
@@ -11,6 +11,6 @@ public class UserGroup
public Group? Group { get; set; } public Group? Group { get; set; }
[Required] public int GroupId { get; set; } [Required] public int GroupId { get; set; }
[Required] public string? Grade { get; set; } [Required] public string? Grade { get; set; }
} }
+1 -1
View File
@@ -8,7 +8,7 @@ public class UserPost
{ {
public User? User { get; set; } public User? User { get; set; }
[Required] public int UserId { get; set; } [Required] public int UserId { get; set; }
public Post? Post { get; set; } public Post? Post { get; set; }
[Required] public int PostId { get; set; } [Required] public int PostId { get; set; }
} }
@@ -11,7 +11,7 @@ public class GetPostNotMeSpec : Specification<Post>
.Include(x => x.User) .Include(x => x.User)
.Include(x => x.UserPosts!) .Include(x => x.UserPosts!)
.ThenInclude(up => up.User) .ThenInclude(up => up.User)
.Where(x => x.UserId != userId && .Where(x => x.UserId != userId &&
x.CreationDate >= DateTime.Today && x.CreationDate < DateTime.Today.AddDays(1)); x.CreationDate >= DateTime.Today && x.CreationDate < DateTime.Today.AddDays(1));
} }
} }
@@ -21,21 +21,21 @@ public class GetPostDtoValidator : Validator<GetPostDto>
.WithMessage("Libelle cannot exceed 100 characters") .WithMessage("Libelle cannot exceed 100 characters")
.MinimumLength(2) .MinimumLength(2)
.WithMessage("Libelle must exceed 2 characters"); .WithMessage("Libelle must exceed 2 characters");
RuleFor(x => x.CreationDate) RuleFor(x => x.CreationDate)
.NotEmpty() .NotEmpty()
.WithMessage("CreationDate cannot be empty"); .WithMessage("CreationDate cannot be empty");
RuleFor(x => x.Likes) RuleFor(x => x.Likes)
.NotEmpty() .NotEmpty()
.WithMessage("Likes cannot be empty"); .WithMessage("Likes cannot be empty");
RuleFor(x => x.UserId) RuleFor(x => x.UserId)
.NotEmpty() .NotEmpty()
.WithMessage("UserId cannot be empty") .WithMessage("UserId cannot be empty")
.GreaterThan(0) .GreaterThan(0)
.WithMessage("UserId must be greater than zero"); .WithMessage("UserId must be greater than zero");
RuleFor(x => x.Username) RuleFor(x => x.Username)
.NotEmpty() .NotEmpty()
.WithMessage("UserUsername cannot be empty"); .WithMessage("UserUsername cannot be empty");
@@ -15,7 +15,7 @@ public class GetRandomChallengeDtoValidator : Validator<GetRandomChallengeDto>
.WithMessage("Label cannot exceed 200 characters") .WithMessage("Label cannot exceed 200 characters")
.MinimumLength(2) .MinimumLength(2)
.WithMessage("Label must exceed 2 characters"); .WithMessage("Label must exceed 2 characters");
RuleFor(x => x.Libelle) RuleFor(x => x.Libelle)
.NotEmpty() .NotEmpty()
.WithMessage("Libelle is required") .WithMessage("Libelle is required")
@@ -50,7 +50,7 @@ public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
.NotEmpty() .NotEmpty()
.WithMessage("DesignationId is required"); .WithMessage("DesignationId is required");
}); });
When(x => x.DesignationName is not null, () => When(x => x.DesignationName is not null, () =>
{ {
RuleFor(x => x.DesignationName) RuleFor(x => x.DesignationName)
@@ -44,7 +44,7 @@ public class GetUserDtoValidator : Validator<GetUserDto>
.NotEmpty() .NotEmpty()
.WithMessage("DesignationId is required"); .WithMessage("DesignationId is required");
}); });
When(x => x.DesignationName is not null, () => When(x => x.DesignationName is not null, () =>
{ {
RuleFor(x => x.DesignationName) RuleFor(x => x.DesignationName)