Skip to content

Commit

Permalink
feat: Rate Limit 적용 - #75
Browse files Browse the repository at this point in the history
  • Loading branch information
Dh3356 committed Feb 24, 2024
1 parent 6a0711e commit 9473621
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.mjulikelion.bagel.service.application.ApplicationCommandService;
import org.mjulikelion.bagel.service.application.ApplicationQueryService;
import org.mjulikelion.bagel.util.annotaion.file.introduce.IntroduceFileConstraint;
import org.mjulikelion.bagel.util.annotaion.ratelimit.RateLimit;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -26,18 +27,21 @@ public class ApplicationController {
private final ApplicationQueryService applicationQueryService;
private final ApplicationCommandService applicationCommandService;

@RateLimit
@GetMapping("/{part}")
public ResponseEntity<ResponseDto<ApplicationGetResponseData>> getApplicationByPart(
@PathVariable("part") String part) {
return this.applicationQueryService.getApplicationByPart(part);
}

@RateLimit
@PostMapping()
public ResponseEntity<ResponseDto<Void>> saveApplication(
@RequestBody @Valid ApplicationSaveDto applicationSaveDto) {
return this.applicationCommandService.saveApplication(applicationSaveDto);
}

@RateLimit
@PostMapping("/file")
public ResponseEntity<ResponseDto<FileSaveResponseData>> saveFile(
@IntroduceFileConstraint @RequestPart MultipartFile file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.mjulikelion.bagel.dto.response.apply.ApplyExistResponseData;
import org.mjulikelion.bagel.service.apply.ApplyCommandService;
import org.mjulikelion.bagel.service.apply.ApplyQueryService;
import org.mjulikelion.bagel.util.annotaion.ratelimit.RateLimit;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -25,12 +26,14 @@ public class ApplyController {
private final ApplyQueryService applyQueryService;
private final ApplyCommandService applyCommandService;

@RateLimit
@GetMapping("/exist/{studentId}")
public ResponseEntity<ResponseDto<ApplyExistResponseData>> getApplicationExist(
@PathVariable("studentId") @Pattern(regexp = APPLICATION_STUDENT_ID_PATTERN) @Valid String studentId) {
return this.applyQueryService.getApplyExist(studentId);
}

@RateLimit
@PostMapping()
public ResponseEntity<ResponseDto<Void>> saveApply(
@RequestBody @Valid ApplySaveDto applySaveDto) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.mjulikelion.bagel.controller;

import org.mjulikelion.bagel.util.annotaion.ratelimit.RateLimit;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HealthController {
@RateLimit
@GetMapping("/health")
public String health() {
return "ok";
Expand Down

0 comments on commit 9473621

Please sign in to comment.