Add rate limiting to getStaffPlaytime and getVoteStats endpoints
This commit is contained in:
@@ -32,6 +32,7 @@ public class SiteController implements SiteApi {
|
|||||||
private final StaffPtService staffPtService;
|
private final StaffPtService staffPtService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@RateLimit(limit = 1, timeValue = 1, timeUnit = TimeUnit.SECONDS, key = "getStaffPlaytime")
|
||||||
public ResponseEntity<StaffPlaytimeListDto> getStaffPlaytime(OffsetDateTime from, OffsetDateTime to) {
|
public ResponseEntity<StaffPlaytimeListDto> getStaffPlaytime(OffsetDateTime from, OffsetDateTime to) {
|
||||||
Optional<List<StaffPlaytimeDto>> staffPlaytimeDto = staffPtService.getStaffPlaytime(from.toInstant(), to.toInstant());
|
Optional<List<StaffPlaytimeDto>> staffPlaytimeDto = staffPtService.getStaffPlaytime(from.toInstant(), to.toInstant());
|
||||||
if (staffPlaytimeDto.isEmpty()) {
|
if (staffPlaytimeDto.isEmpty()) {
|
||||||
@@ -43,6 +44,7 @@ public class SiteController implements SiteApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@RateLimit(limit = 5, timeValue = 1, timeUnit = TimeUnit.MINUTES, key = "getVoteStats")
|
||||||
public ResponseEntity<VoteDataDto> getVoteStats() {
|
public ResponseEntity<VoteDataDto> getVoteStats() {
|
||||||
UUID uuid = authenticatedUuid.getAuthenticatedUserUuid();
|
UUID uuid = authenticatedUuid.getAuthenticatedUserUuid();
|
||||||
Optional<VoteDataDto> optionalVoteDataDto = voteService.getVoteStats(uuid);
|
Optional<VoteDataDto> optionalVoteDataDto = voteService.getVoteStats(uuid);
|
||||||
|
|||||||
Reference in New Issue
Block a user