Skip to content

Commit

Permalink
[feat] RequestMapping 으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
sanghee0820 committed Oct 9, 2024
1 parent 1446b98 commit 0d8f59c
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,11 +23,12 @@

@RequiredArgsConstructor
@RestController
@RequestMapping("/influencers")
public class InfluencerController implements InfluencerControllerApiSpec {

private final InfluencerService influencerService;

@GetMapping("/influencers")
@GetMapping()
public ResponseEntity<InfluencerListResponse> getAllInfluencers() {
List<InfluencerInfo> influencersDtoList = influencerService.getAllInfluencers();
List<InfluencerResponse> influencers = influencersDtoList.stream()
Expand All @@ -37,7 +39,7 @@ public ResponseEntity<InfluencerListResponse> getAllInfluencers() {
return new ResponseEntity<>(response, HttpStatus.OK);
}

@PostMapping("/influencers")
@PostMapping()
public ResponseEntity<Long> createInfluencer(@RequestBody InfluencerRequest request) {
InfluencerCommand influencerCommand = new InfluencerCommand(
request.influencerName(),
Expand All @@ -49,7 +51,7 @@ public ResponseEntity<Long> createInfluencer(@RequestBody InfluencerRequest requ
return new ResponseEntity<>(savedId, HttpStatus.OK);
}

@PutMapping("/influencers/{id}")
@PutMapping("/{id}")
public ResponseEntity<Long> updateInfluencer(@PathVariable Long id,
@RequestBody InfluencerRequest request) {
InfluencerCommand influencerCommand = new InfluencerCommand(
Expand All @@ -62,7 +64,7 @@ public ResponseEntity<Long> updateInfluencer(@PathVariable Long id,
return new ResponseEntity<>(updatedId, HttpStatus.OK);
}

@DeleteMapping("/influencers/{id}")
@DeleteMapping("/{id}")
public ResponseEntity<Long> deleteInfluencer(@PathVariable Long id) {
influencerService.deleteInfluencer(id);

Expand Down

0 comments on commit 0d8f59c

Please sign in to comment.