Skip to content

Commit

Permalink
chore: 교환 코인 줄어드는 시점 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimin0304 committed Nov 27, 2023
1 parent 7d6a3ce commit 6371cef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public AddExchangePostReponseDTO addExchange(Member member, ExchangePostRequestD

ExchangePost saved = exchangePostRepository.save(exchangePost);
gifticon.updateActive(false);
gifticon.getMember().minusExchangeCoin();

return AddExchangePostReponseDTO.from(saved);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,10 @@ public void acceptExchangeRequest(Member member, long exchangePostId, long excha
request.updateStatus(REJECTED);
request.getGifticon().updateActive(true);
}

if (member.getExchangeCoin() < 1 || exchangeRequest.getGifticon().getMember().getExchangeCoin() < 1)
throw new BusinessException(ErrorCode.TOO_LITTLE_COIN);
member.minusExchangeCoin();
exchangeRequest.getGifticon().getMember().minusExchangeCoin();
}
}

0 comments on commit 6371cef

Please sign in to comment.