From 70d96e85906ccb1ddf4963d99d7ba2c412fa43c7 Mon Sep 17 00:00:00 2001 From: Kang Duoh Date: Sun, 24 Nov 2024 00:24:59 +0900 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor[#25]:=20PointHome?= =?UTF-8?q?Response=EC=97=90=20userName=20=EB=B0=98=ED=99=98=EA=B0=92=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../swipo/domain/point/dto/Response/PointHomeResponse.java | 5 ++++- .../com/groom/swipo/domain/point/service/PointService.java | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/groom/swipo/domain/point/dto/Response/PointHomeResponse.java b/src/main/java/com/groom/swipo/domain/point/dto/Response/PointHomeResponse.java index a0fc12e..b779df3 100644 --- a/src/main/java/com/groom/swipo/domain/point/dto/Response/PointHomeResponse.java +++ b/src/main/java/com/groom/swipo/domain/point/dto/Response/PointHomeResponse.java @@ -10,13 +10,16 @@ @Builder public record PointHomeResponse( + String userName, Integer balance, // 페이잔액 Integer totalCards, //사용자가 보유한 모든 지역 카드 수 List cards, List paylistInfos ) { - public static PointHomeResponse of(Pay pay, Integer totalCards, List cards, List paylistInfos){ + public static PointHomeResponse of(String userName, Pay pay, Integer totalCards, List cards, + List paylistInfos) { return PointHomeResponse.builder() + .userName(userName) .balance(pay.getTotalPay()) .totalCards(totalCards) .cards(cards) diff --git a/src/main/java/com/groom/swipo/domain/point/service/PointService.java b/src/main/java/com/groom/swipo/domain/point/service/PointService.java index 1d26626..d7f07bf 100644 --- a/src/main/java/com/groom/swipo/domain/point/service/PointService.java +++ b/src/main/java/com/groom/swipo/domain/point/service/PointService.java @@ -69,7 +69,7 @@ public PointHomeResponse getHome(Principal principal) { .map(paylist -> PaylistInfo.of(paylist, paylist.getStore())) .toList(); - return PointHomeResponse.of(pay, cardInfos.size(), cardInfos, paylistInfos); + return PointHomeResponse.of(user.getName(), pay, cardInfos.size(), cardInfos, paylistInfos); } @Transactional @@ -154,7 +154,7 @@ public PointTransferInfoResponse getPointTransferInfo(Principal principal) { .map(CardInfo::from) .toList(); - return PointTransferInfoResponse.of(cards.size(),cardInfos); + return PointTransferInfoResponse.of(cards.size(), cardInfos); } // 포인트 이전 @@ -170,7 +170,7 @@ public PointTransferResponse pointTransfer(PointTransferRequest request, Princip //해당 유저가 가진 카드가 맞는지 검증 if (!Objects.equals(user.getId(), toCard.getUser().getId()) & !Objects.equals(user.getId(), - toCard.getUser().getId())){ + toCard.getUser().getId())) { throw new CardNotFoundException("해당 유저가 보유한 카드가 아닙니다"); }