-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
api/src/main/java/hexagonal/api/member/adapter/in/web/UpdateMemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package hexagonal.api.member.adapter.in.web; | ||
|
||
import hexagonal.api.member.adapter.in.web.request.UpdateMemberReq; | ||
import hexagonal.api.member.adapter.in.web.response.UpdateMemberResponse; | ||
import hexagonal.api.member.application.port.in.UpdateMemberCommand; | ||
import hexagonal.api.member.application.port.in.UpdateMemberUseCase; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class UpdateMemberController { | ||
|
||
private final UpdateMemberUseCase updateMemberUseCase; | ||
|
||
@PutMapping("/v1/member/{id}") | ||
ResponseEntity<UpdateMemberResponse> updateMember(@RequestBody UpdateMemberReq memberInfo, | ||
@PathVariable("id") Long id) { | ||
// ToDo 입력모델 Valid Check 예외 처리 | ||
UpdateMemberCommand command = new UpdateMemberCommand( | ||
id, | ||
memberInfo.getName(), | ||
memberInfo.getType()); | ||
|
||
Long memId = updateMemberUseCase.updateMember(command); | ||
UpdateMemberResponse response = new UpdateMemberResponse(memId, memberInfo.getName()); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |