Cleaned code
This commit is contained in:
@@ -20,7 +20,7 @@ public class GetAllProofsEndpoint(UserGroupsRepository userGroupsRepository, Gro
|
|||||||
|
|
||||||
public override async Task HandleAsync(GroupProofRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GroupProofRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Group? group = await groupsRepository.SingleOrDefaultAsync(new GetGroupByIdSpec(req.Id), ct);
|
Group? group = await groupsRepository.SingleOrDefaultAsync(new GetGroupByIdSpec(req.Id), ct);
|
||||||
if (group is null)
|
if (group is null)
|
||||||
{
|
{
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class PatchProofEndpoint(
|
|||||||
|
|
||||||
if (randomChallenge.GeneratedAt != null && DateTime.Now > randomChallenge.GeneratedAt.Value.AddHours(randomChallenge.Duration))
|
if (randomChallenge.GeneratedAt != null && DateTime.Now > randomChallenge.GeneratedAt.Value.AddHours(randomChallenge.Duration))
|
||||||
{
|
{
|
||||||
await Send.StringAsync("Le défi est terminé", 400, cancellation: ct);
|
await Send.StringAsync("Le défi est terminé", 400, cancellation: ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,5 @@ public class UnlockAchievementDtoValidator : Validator<UnlockAchievementDto>
|
|||||||
.WithMessage("AchievementId cannot be empty")
|
.WithMessage("AchievementId cannot be empty")
|
||||||
.GreaterThan(0)
|
.GreaterThan(0)
|
||||||
.WithMessage("AchievementId must be greater than 0");
|
.WithMessage("AchievementId must be greater than 0");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ using FluentValidation;
|
|||||||
|
|
||||||
namespace BeReadyBackend.Validators.Auth;
|
namespace BeReadyBackend.Validators.Auth;
|
||||||
|
|
||||||
public class LoginDtoValidator: Validator<LoginDto>
|
public class LoginDtoValidator : Validator<LoginDto>
|
||||||
{
|
{
|
||||||
public LoginDtoValidator()
|
public LoginDtoValidator()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Friends;
|
|||||||
|
|
||||||
public class GetFriendDtoValidator : Validator<GetFriendDto>
|
public class GetFriendDtoValidator : Validator<GetFriendDto>
|
||||||
{
|
{
|
||||||
public GetFriendDtoValidator()
|
public GetFriendDtoValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Username)
|
RuleFor(x => x.Username)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Friends;
|
|||||||
|
|
||||||
public class GetFriendRequestDtoValidator : Validator<GetFriendDto>
|
public class GetFriendRequestDtoValidator : Validator<GetFriendDto>
|
||||||
{
|
{
|
||||||
public GetFriendRequestDtoValidator()
|
public GetFriendRequestDtoValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Username)
|
RuleFor(x => x.Username)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Users;
|
|||||||
|
|
||||||
public class GetUserChallengeDtoValidator : Validator<GetUserChallengeDto>
|
public class GetUserChallengeDtoValidator : Validator<GetUserChallengeDto>
|
||||||
{
|
{
|
||||||
public GetUserChallengeDtoValidator()
|
public GetUserChallengeDtoValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.ChallengeTitle)
|
RuleFor(x => x.ChallengeTitle)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Users;
|
|||||||
|
|
||||||
public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
|
public class GetUserDetailsDtoValidator : Validator<GetUserDetailsDto>
|
||||||
{
|
{
|
||||||
public GetUserDetailsDtoValidator()
|
public GetUserDetailsDtoValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.FirstName)
|
RuleFor(x => x.FirstName)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ namespace BeReadyBackend.Validators.Users;
|
|||||||
|
|
||||||
public class GetUserDtoValidator : Validator<GetUserDto>
|
public class GetUserDtoValidator : Validator<GetUserDto>
|
||||||
{
|
{
|
||||||
public GetUserDtoValidator() {
|
public GetUserDtoValidator()
|
||||||
|
{
|
||||||
RuleFor(x => x.Id)
|
RuleFor(x => x.Id)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Id cannot be empty")
|
.WithMessage("Id cannot be empty")
|
||||||
|
|||||||
@@ -6,30 +6,30 @@ namespace BeReadyBackend.Validators.Users;
|
|||||||
|
|
||||||
public class GetUserStatsDtoValidator : Validator<GetUserStatsDto>
|
public class GetUserStatsDtoValidator : Validator<GetUserStatsDto>
|
||||||
{
|
{
|
||||||
public GetUserStatsDtoValidator()
|
public GetUserStatsDtoValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Score)
|
RuleFor(x => x.Score)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Score is required");
|
.WithMessage("Score is required");
|
||||||
|
|
||||||
RuleFor(x => x.TotalWin)
|
RuleFor(x => x.TotalWin)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Total win is required");
|
.WithMessage("Total win is required");
|
||||||
|
|
||||||
RuleFor(x=> x.TotalChallenge)
|
RuleFor(x => x.TotalChallenge)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Total challenge is required");
|
.WithMessage("Total challenge is required");
|
||||||
|
|
||||||
RuleFor(x => x.TotalPodium)
|
RuleFor(x => x.TotalPodium)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Total podium is required");
|
.WithMessage("Total podium is required");
|
||||||
|
|
||||||
RuleFor(x => x.TotalBonusChallenge)
|
RuleFor(x => x.TotalBonusChallenge)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Total bonus is required");
|
.WithMessage("Total bonus is required");
|
||||||
|
|
||||||
RuleFor(x => x.Series)
|
RuleFor(x => x.Series)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("Series is required");
|
.WithMessage("Series is required");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace BeReadyBackend.Validators.Users;
|
|||||||
|
|
||||||
public class UpdateUserDtoValidator : Validator<UpdateUserDto>
|
public class UpdateUserDtoValidator : Validator<UpdateUserDto>
|
||||||
{
|
{
|
||||||
public UpdateUserDtoValidator()
|
public UpdateUserDtoValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.FirstName)
|
RuleFor(x => x.FirstName)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
|
|||||||
Reference in New Issue
Block a user