From 0d8f59cb49773695d1345560cb645dc103895219 Mon Sep 17 00:00:00 2001 From: sanghee0820 Date: Wed, 9 Oct 2024 23:10:38 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20RequestMapping=20=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../influencer/presentation/InfluencerController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java b/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java index a38778fa..bcd4a545 100644 --- a/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java +++ b/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import team7.inplace.influencer.application.InfluencerService; import team7.inplace.influencer.application.dto.InfluencerCommand; @@ -22,11 +23,12 @@ @RequiredArgsConstructor @RestController +@RequestMapping("/influencers") public class InfluencerController implements InfluencerControllerApiSpec { private final InfluencerService influencerService; - @GetMapping("/influencers") + @GetMapping() public ResponseEntity getAllInfluencers() { List influencersDtoList = influencerService.getAllInfluencers(); List influencers = influencersDtoList.stream() @@ -37,7 +39,7 @@ public ResponseEntity getAllInfluencers() { return new ResponseEntity<>(response, HttpStatus.OK); } - @PostMapping("/influencers") + @PostMapping() public ResponseEntity createInfluencer(@RequestBody InfluencerRequest request) { InfluencerCommand influencerCommand = new InfluencerCommand( request.influencerName(), @@ -49,7 +51,7 @@ public ResponseEntity createInfluencer(@RequestBody InfluencerRequest requ return new ResponseEntity<>(savedId, HttpStatus.OK); } - @PutMapping("/influencers/{id}") + @PutMapping("/{id}") public ResponseEntity updateInfluencer(@PathVariable Long id, @RequestBody InfluencerRequest request) { InfluencerCommand influencerCommand = new InfluencerCommand( @@ -62,7 +64,7 @@ public ResponseEntity updateInfluencer(@PathVariable Long id, return new ResponseEntity<>(updatedId, HttpStatus.OK); } - @DeleteMapping("/influencers/{id}") + @DeleteMapping("/{id}") public ResponseEntity deleteInfluencer(@PathVariable Long id) { influencerService.deleteInfluencer(id);