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 int Likes { get; set; }
public bool IsLiked { get; set; }
public int UserId { get; set; }
public string? Username { get; set; }
}
+1 -1
View File
@@ -1,6 +1,6 @@
namespace BeReadyBackend.DTO.Users;
public class GetUserProofDto
{
{
public string? Proof { get; set; }
}
@@ -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);
@@ -18,7 +18,7 @@ public class DtoToEntityMappings : Profile
CreateMap<CreateUserDto, User>();
CreateMap<UpdateUserDto, User>();
CreateMap<PatchUserDesignationDto, User>();
CreateMap<SendFriendDto, UserFriend>();
CreateMap<CreateGroupDto, Group>()
+1 -1
View File
@@ -11,6 +11,6 @@ public class Post
public User? User { get; set; }
[Required] public int UserId { get; set; }
public List<UserPost>? UserPosts { get; set; }
}
+1 -1
View File
@@ -11,6 +11,6 @@ public class UserGroup
public Group? Group { get; set; }
[Required] public int GroupId { get; set; }
[Required] public string? Grade { get; set; }
}
+1 -1
View File
@@ -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; }
}
@@ -11,7 +11,7 @@ public class GetPostNotMeSpec : Specification<Post>
.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));
}
}
@@ -21,21 +21,21 @@ public class GetPostDtoValidator : Validator<GetPostDto>
.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");
@@ -15,7 +15,7 @@ public class GetRandomChallengeDtoValidator : Validator<GetRandomChallengeDto>
.WithMessage("Label cannot exceed 200 characters")
.MinimumLength(2)
.WithMessage("Label must exceed 2 characters");
RuleFor(x => x.Libelle)
.NotEmpty()
.WithMessage("Libelle is required")
@@ -50,7 +50,7 @@ public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
.NotEmpty()
.WithMessage("DesignationId is required");
});
When(x => x.DesignationName is not null, () =>
{
RuleFor(x => x.DesignationName)
@@ -44,7 +44,7 @@ public class GetUserDtoValidator : Validator<GetUserDto>
.NotEmpty()
.WithMessage("DesignationId is required");
});
When(x => x.DesignationName is not null, () =>
{
RuleFor(x => x.DesignationName)