Skip to content

Commit ebca024

Browse files
authored
Merge pull request #42 from 9git9git/hotfix
🐛 [HOTFIX] 버그 수정
2 parents 188d91b + b2ddcf5 commit ebca024

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

app/crud/category.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from fastapi import HTTPException, status
12
from typing import List, Optional
23
from uuid import UUID
34
from sqlalchemy import select, delete
@@ -49,8 +50,14 @@ async def read_category_by_name(
4950

5051
# 카테고리 수정
5152
async def update_category(
52-
db: AsyncSession, db_category: Category, category_data: CategoryUpdate
53+
db: AsyncSession, category_id: UUID, category_data: CategoryUpdate
5354
) -> CategoryResponse:
55+
db_category = await read_category_by_id(db, category_id)
56+
if not db_category:
57+
raise HTTPException(
58+
status_code=status.HTTP_404_NOT_FOUND, detail="카테고리를 찾을 수 없습니다."
59+
)
60+
5461
update_data = category_data.model_dump(exclude_unset=True)
5562

5663
for key, value in update_data.items():

app/schemas/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
class TodosAndMemosResponse(BaseModel):
88
todos: List[TodoResponse]
99
memos: List[MemoResponse]
10-
cheerUpMessage: str

0 commit comments

Comments
 (0)