File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from fastapi import HTTPException , status
12from typing import List , Optional
23from uuid import UUID
34from sqlalchemy import select , delete
@@ -49,8 +50,14 @@ async def read_category_by_name(
4950
5051# 카테고리 수정
5152async 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 ():
Original file line number Diff line number Diff line change 77class TodosAndMemosResponse (BaseModel ):
88 todos : List [TodoResponse ]
99 memos : List [MemoResponse ]
10- cheerUpMessage : str
You can’t perform that action at this time.
0 commit comments