Add rate limiting to getStaffPlaytime and getVoteStats endpoints

This commit is contained in:
akastijn 2025-11-02 23:03:00 +01:00
parent 39b7a398a5
commit 2bdebb71b7

View File

@ -32,6 +32,7 @@ public class SiteController implements SiteApi {
private final StaffPtService staffPtService;
@Override
@RateLimit(limit = 1, timeValue = 1, timeUnit = TimeUnit.SECONDS, key = "getStaffPlaytime")
public ResponseEntity<StaffPlaytimeListDto> getStaffPlaytime(OffsetDateTime from, OffsetDateTime to) {
Optional<List<StaffPlaytimeDto>> staffPlaytimeDto = staffPtService.getStaffPlaytime(from.toInstant(), to.toInstant());
if (staffPlaytimeDto.isEmpty()) {
@ -43,6 +44,7 @@ public class SiteController implements SiteApi {
}
@Override
@RateLimit(limit = 5, timeValue = 1, timeUnit = TimeUnit.MINUTES, key = "getVoteStats")
public ResponseEntity<VoteDataDto> getVoteStats() {
UUID uuid = authenticatedUuid.getAuthenticatedUserUuid();
Optional<VoteDataDto> optionalVoteDataDto = voteService.getVoteStats(uuid);