Skip to content

Commit

Permalink
NABI-122--refactor : 카드 주인이 맞지 않을 시 예외 발생
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-june committed Nov 10, 2023
1 parent 2c235a7 commit a20230b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ public void deleteCardById(
Card card = cardRepository.findById(cardId)
.orElseThrow(() -> new BaseException(ErrorCode.CARD_NOT_FOUND));

checkService.isEqual(token, card.getUser().getUserId());
if (!checkService.isEqual(token, card.getUser().getUserId())) {
throw new BaseException(ErrorCode.USER_NOT_MATCHED);
}

cardRepository.delete(card);
}
Expand Down

0 comments on commit a20230b

Please sign in to comment.