From 10f63a1e2ead60347cc8f2271726a770af6ab0ea Mon Sep 17 00:00:00 2001 From: Coldot <41678750+Coldot@users.noreply.github.com> Date: Mon, 1 Sep 2025 20:59:46 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=EB=93=9C=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 사용자 ID와 카드 ID를 기반으로 카드를 삭제하는 delete_card 메서드 구현 - 카드 존재 여부 및 접근 권한 검증 로직 추가 - 관련 예외 처리 및 문서화 진행 --- src/main/card/service/CardService.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/card/service/CardService.py b/src/main/card/service/CardService.py index b685f65..e060cbf 100644 --- a/src/main/card/service/CardService.py +++ b/src/main/card/service/CardService.py @@ -13,6 +13,7 @@ def update_ai_summary(self, user_id: uuid.UUID, card_id: uuid.UUID) -> CardAISum def get_cards_by_space(self, space_id: uuid.UUID) -> List[Card]: ... def create_card_with_links(self, space_id: uuid.UUID, title: str, chat_id: uuid.UUID, points: List[str]) -> Card: ... def delete_ai_summary(self, user_id: uuid.UUID, card_id: uuid.UUID) -> None: ... + def delete_card(self, user_id: uuid.UUID, card_id: uuid.UUID) -> None: ... class CardService(CardServiceProtocol): def __init__( @@ -96,4 +97,25 @@ def create_card_with_links(self, space_id: uuid.UUID, title: str, chat_id: uuid. for point in points: self.repository.create_cardlink(card_id, chat_id, point) - return card \ No newline at end of file + return card + + def delete_card(self, user_id: uuid.UUID, card_id: uuid.UUID) -> None: + """ + 카드를 삭제합니다. + + Args: + user_id: 사용자 ID + card_id: 카드 ID + + Raises: + HTTPException: 카드가 존재하지 않거나 접근 권한이 없는 경우 + """ + card = self.repository.get_by_id(card_id) + if not card: + raise HTTPException( + status_code=404, + detail="Resource not found" + ) + + self._verify_card_ownership(card, user_id) + self.repository.delete(card_id) \ No newline at end of file