don't save banned or inactive accounts
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m21s

This commit is contained in:
Lee 2024-04-25 20:23:51 +01:00
parent 6c63534988
commit d96a38a996

@ -4,6 +4,7 @@ import cc.fascinated.backend.Main;
import cc.fascinated.backend.common.DateUtils;
import cc.fascinated.backend.common.Timer;
import cc.fascinated.backend.common.WebRequest;
import cc.fascinated.backend.exception.impl.BadRequestException;
import cc.fascinated.backend.exception.impl.RateLimitException;
import cc.fascinated.backend.exception.impl.ResourceNotFoundException;
import cc.fascinated.backend.model.account.Account;
@ -79,6 +80,12 @@ public class ScoreSaberService extends TextWebSocketHandler {
log.info("Account with id '{}' not found.", id);
throw new ResourceNotFoundException("Account with id '%s' not found.".formatted(id));
}
if (account.isBanned()) {
throw new BadRequestException("Account with id '%s' is banned.".formatted(id));
}
if (account.isInactive()) {
throw new BadRequestException("Account with id '%s' is inactive.".formatted(id));
}
return account;
}