-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: 가족 API Mapper 구조 리팩토링 #240
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e009e91
refactor: mapper - controller 분리 #238
ozzing 72d7a14
refactor: mapper - service 정리 #238
ozzing 76aaecd
refactor: 유저 탈퇴, 가족 나가기 api 매퍼 리팩토링 #239
ozzing bd247fa
refactor: 유저 탈퇴, 가족 나가기 api 매퍼 리팩토링 #238
ozzing 363336f
Merge remote-tracking branch 'origin/refactor/familyMapper' into refa…
ozzing c55f4a6
refactor: mapper 레이어 crud로 메소드명 통일 #238
ozzing 9f93bbd
refactor: service 레이어 직관적으로 메소드명 통일 #238
ozzing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
93 changes: 93 additions & 0 deletions
93
src/main/java/com/ceos/bankids/controller/FamilyController.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,93 @@ | ||
package com.ceos.bankids.controller; | ||
|
||
import com.ceos.bankids.config.CommonResponse; | ||
import com.ceos.bankids.controller.request.FamilyRequest; | ||
import com.ceos.bankids.domain.User; | ||
import com.ceos.bankids.dto.FamilyDTO; | ||
import com.ceos.bankids.dto.KidListDTO; | ||
import com.ceos.bankids.mapper.FamilyMapper; | ||
import io.swagger.annotations.ApiOperation; | ||
import java.util.List; | ||
import javax.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
@Slf4j | ||
@Controller | ||
@RequestMapping("/family") | ||
@RequiredArgsConstructor | ||
public class FamilyController { | ||
|
||
private final FamilyMapper familyMapper; | ||
|
||
@ApiOperation(value = "가족 생성하기") | ||
@PostMapping(value = "", produces = "application/json; charset=utf-8") | ||
@ResponseBody | ||
public CommonResponse<FamilyDTO> postNewFamily(@AuthenticationPrincipal User authUser) { | ||
|
||
log.info("api = 가족 생성하기, user = {}", authUser.getUsername()); | ||
|
||
FamilyDTO familyDTO = familyMapper.createFamily(authUser); | ||
|
||
return CommonResponse.onSuccess(familyDTO); | ||
} | ||
|
||
@ApiOperation(value = "가족 정보 조회하기") | ||
@GetMapping(value = "", produces = "application/json; charset=utf-8") | ||
@ResponseBody | ||
public CommonResponse<FamilyDTO> getFamily(@AuthenticationPrincipal User authUser) { | ||
|
||
log.info("api = 가족 정보 조회하기, user = {}", authUser.getUsername()); | ||
|
||
FamilyDTO familyDTO = familyMapper.readFamily(authUser); | ||
|
||
return CommonResponse.onSuccess(familyDTO); | ||
} | ||
|
||
@ApiOperation(value = "아이들 목록 조회하기") | ||
@GetMapping(value = "/kid", produces = "application/json; charset=utf-8") | ||
@ResponseBody | ||
public CommonResponse<List<KidListDTO>> getFamilyKidList( | ||
@AuthenticationPrincipal User authUser) { | ||
|
||
log.info("api = 아이들 목록 조회하기, user = {}", authUser.getUsername()); | ||
|
||
List<KidListDTO> kidListDTOList = familyMapper.readFamilyKidList(authUser); | ||
|
||
return CommonResponse.onSuccess(kidListDTOList); | ||
} | ||
|
||
@ApiOperation(value = "가족 참여하기") | ||
@PostMapping(value = "/user", produces = "application/json; charset=utf-8") | ||
@ResponseBody | ||
public CommonResponse<FamilyDTO> postFamilyUser(@AuthenticationPrincipal User authUser, | ||
@Valid @RequestBody FamilyRequest familyRequest) { | ||
|
||
log.info("api = 가족 참여하기, user = {}", authUser.getUsername()); | ||
|
||
FamilyDTO familyDTO = familyMapper.createFamilyUser(authUser, familyRequest); | ||
|
||
return CommonResponse.onSuccess(familyDTO); | ||
} | ||
|
||
@ApiOperation(value = "가족 나가기") | ||
@DeleteMapping(value = "/user", produces = "application/json; charset=utf-8") | ||
@ResponseBody | ||
public CommonResponse<FamilyDTO> deleteFamilyUser(@AuthenticationPrincipal User authUser, | ||
@Valid @RequestBody FamilyRequest familyRequest) { | ||
|
||
log.info("api = 가족 나가기, user = {}", authUser.getUsername()); | ||
|
||
FamilyDTO familyDTO = familyMapper.deleteFamilyUser(authUser, familyRequest); | ||
|
||
return CommonResponse.onSuccess(familyDTO); | ||
} | ||
} |
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
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
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
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
157 changes: 0 additions & 157 deletions
157
src/main/java/com/ceos/bankids/mapper/FamilyController.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 요로코롬 직관적으로 바꾸겠습니다