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 6a0f6e6 commit 1446b98
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public class InfluencerController implements InfluencerControllerApiSpec {

private final InfluencerService influencerService;

@GetMapping()
@GetMapping("/influencers")
public ResponseEntity<InfluencerListResponse> getAllInfluencers() {
List<InfluencerInfo> influencersDtoList = influencerService.getAllInfluencers();
List<InfluencerResponse> influencers = influencersDtoList.stream()
.map(InfluencerResponse::from)
.toList();
.map(InfluencerResponse::from)
.toList();
InfluencerListResponse response = new InfluencerListResponse(influencers);

return new ResponseEntity<>(response, HttpStatus.OK);
Expand All @@ -40,9 +40,9 @@ public ResponseEntity<InfluencerListResponse> getAllInfluencers() {
@PostMapping("/influencers")
public ResponseEntity<Long> createInfluencer(@RequestBody InfluencerRequest request) {
InfluencerCommand influencerCommand = new InfluencerCommand(
request.influencerName(),
request.influencerImgUrl(),
request.influencerJob()
request.influencerName(),
request.influencerImgUrl(),
request.influencerJob()
);
Long savedId = influencerService.createInfluencer(influencerCommand);

Expand All @@ -51,11 +51,11 @@ public ResponseEntity<Long> createInfluencer(@RequestBody InfluencerRequest requ

@PutMapping("/influencers/{id}")
public ResponseEntity<Long> updateInfluencer(@PathVariable Long id,
@RequestBody InfluencerRequest request) {
@RequestBody InfluencerRequest request) {
InfluencerCommand influencerCommand = new InfluencerCommand(
request.influencerName(),
request.influencerImgUrl(),
request.influencerJob()
request.influencerName(),
request.influencerImgUrl(),
request.influencerJob()
);
Long updatedId = influencerService.updateInfluencer(id, influencerCommand);

Expand Down

0 comments on commit 1446b98

Please sign in to comment.