Skip to content

Commit

Permalink
refactor: 이자 지급 API Mapper 구조로 리팩토링 #232
Browse files Browse the repository at this point in the history
  • Loading branch information
sanbonai06 committed Sep 19, 2022
1 parent 7b1742a commit e6cabdc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/ceos/bankids/controller/ChallengeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.ceos.bankids.config.CommonResponse;
import com.ceos.bankids.domain.User;
import com.ceos.bankids.dto.AchievedChallengeDTO;
import com.ceos.bankids.dto.AchievedChallengeListDTO;
import com.ceos.bankids.dto.ChallengeDTO;
import com.ceos.bankids.dto.KidAchievedChallengeListDTO;
Expand Down Expand Up @@ -152,4 +153,19 @@ public CommonResponse<KidAchievedChallengeListDTO> getKidAchievedListChallenge(

return CommonResponse.onSuccess(kidAchievedListChallenge);
}

@ApiOperation(value = "완주한 돈길에 이자 지급하기")
@PatchMapping(value = "/interest-payment/{challengeId}", produces = "application/json; charset=utf-8")
public CommonResponse<AchievedChallengeDTO> patchInterestPayment(
@AuthenticationPrincipal User authUser,
@PathVariable Long challengeId) {

log.info("api = 완주한 돈길에 이자 지급, user = {}, challengeId = {}", authUser.getUsername(),
challengeId);

AchievedChallengeDTO achievedChallengeDTO = challengeMapper.patchInterestPayment(authUser,
challengeId);

return CommonResponse.onSuccess(achievedChallengeDTO);
}
}
14 changes: 4 additions & 10 deletions src/main/java/com/ceos/bankids/mapper/ChallengeMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public AchievedChallengeListDTO getAchievedListChallenge(User authUser,
interestPayment);
}

// 자녀의 완주한 돈길 리스트 가져오기 API Mapper
public KidAchievedChallengeListDTO getKidAchievedListChallenge(User authUser, Long kidId,
String interestPayment) {

Expand All @@ -289,19 +290,12 @@ public KidAchievedChallengeListDTO getKidAchievedListChallenge(User authUser, Lo
authUser, achievedChallengeUserList, interestPayment, kidId);
}

@ApiOperation(value = "완주한 돈길에 이자 지급하기")
@PatchMapping(value = "/interest-payment/{challengeId}", produces = "application/json; charset=utf-8")
public CommonResponse<AchievedChallengeDTO> patchInterestPayment(
@AuthenticationPrincipal User authUser,
@PathVariable Long challengeId) {
// 이자 지급 API Mapper
public AchievedChallengeDTO patchInterestPayment(User authUser, Long challengeId) {

log.info("api = 완주한 돈길에 이자 지급, user = {}, challengeId = {}", authUser.getUsername(),
challengeId);
AchievedChallengeDTO achievedChallengeDTO = challengeService.updateChallengeInterestPayment(
return challengeService.updateChallengeInterestPayment(
authUser,
challengeId);

return CommonResponse.onSuccess(achievedChallengeDTO);
}

@ApiOperation(value = "돈길 걷기")
Expand Down

0 comments on commit e6cabdc

Please sign in to comment.