1919router = APIRouter ()
2020
2121
22- @router .get ("/" , response_model = ResponseBase [List [ChatResponse ]])
22+ @router .get ("/all " , response_model = ResponseBase [List [ChatResponse ]])
2323async def get_chats_by_user (
2424 user_id : UUID ,
2525 db : AsyncSession = Depends (get_db ),
@@ -35,31 +35,16 @@ async def get_chats_by_user(
3535 )
3636
3737
38- @router .get ("/storage/{storage_id}" , response_model = ResponseBase [List [ChatResponse ]])
39- async def get_chats_by_storage (
40- user_id : UUID ,
41- storage_id : UUID ,
42- db : AsyncSession = Depends (get_db ),
43- ) -> ResponseBase [List [ChatResponse ]]:
44- try :
45- chats = await select_chats_by_storage (db , user_id , storage_id )
46- return ResponseBase (status_code = status .HTTP_200_OK , data = chats )
47- except HTTPException as e :
48- return ResponseBase (status_code = e .status_code , error = e .detail )
49- except Exception as e :
50- return ResponseBase (
51- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , error = str (e )
52- )
53-
54-
5538@router .get ("/" , response_model = ResponseBase [List [ChatResponse ]])
56- async def get_chats_by_category (
39+ async def get_chats_by_storage_and_category (
5740 user_id : UUID ,
41+ storage_id : UUID ,
5842 category_id : UUID ,
5943 db : AsyncSession = Depends (get_db ),
6044) -> ResponseBase [List [ChatResponse ]]:
6145 try :
62- chats = await select_chats_by_category (db , user_id , category_id )
46+ # 스토리지 ID 기준으로 조회 (storage_id가 URL 접두사에 이미 포함되어 있음)
47+ chats = await select_chats_by_storage (db , user_id , storage_id , category_id )
6348 return ResponseBase (status_code = status .HTTP_200_OK , data = chats )
6449 except HTTPException as e :
6550 return ResponseBase (status_code = e .status_code , error = e .detail )
0 commit comments