From a20230b18a08343c926c34c0b617a893adc67842 Mon Sep 17 00:00:00 2001 From: hi-june Date: Fri, 10 Nov 2023 16:34:16 +0900 Subject: [PATCH] =?UTF-8?q?NABI-122--refactor=20:=20=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EC=A3=BC=EC=9D=B8=EC=9D=B4=20=EB=A7=9E=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=84=20=EC=8B=9C=20=EC=98=88=EC=99=B8=20=EB=B0=9C=EC=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prgrms/nabimarketbe/domain/card/service/CardService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java index c6bd8697..3bebe4dc 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java @@ -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); }