1- from typing import Annotated
1+ from typing import Annotated , Union , Dict , Any
22
33from fastapi import Request , Depends
44from sqlalchemy .ext .asyncio import AsyncSession
@@ -23,7 +23,7 @@ async def write_post(
2323 post : PostCreate ,
2424 current_user : Annotated [UserRead , Depends (get_current_user )],
2525 db : Annotated [AsyncSession , Depends (async_get_db )]
26- ):
26+ ) -> PostRead :
2727 db_user = await crud_users .get (db = db , schema_to_select = UserRead , username = username , is_deleted = False )
2828 if db_user is None :
2929 raise NotFoundException ("User not found" )
@@ -50,7 +50,7 @@ async def read_posts(
5050 db : Annotated [AsyncSession , Depends (async_get_db )],
5151 page : int = 1 ,
5252 items_per_page : int = 10
53- ):
53+ ) -> PaginatedListResponse [ PostRead ] :
5454 db_user = await crud_users .get (db = db , schema_to_select = UserRead , username = username , is_deleted = False )
5555 if not db_user :
5656 raise NotFoundException ("User not found" )
@@ -78,7 +78,7 @@ async def read_post(
7878 username : str ,
7979 id : int ,
8080 db : Annotated [AsyncSession , Depends (async_get_db )]
81- ):
81+ ) -> PostRead :
8282 db_user = await crud_users .get (db = db , schema_to_select = UserRead , username = username , is_deleted = False )
8383 if db_user is None :
8484 raise NotFoundException ("User not found" )
@@ -103,7 +103,7 @@ async def patch_post(
103103 values : PostUpdate ,
104104 current_user : Annotated [UserRead , Depends (get_current_user )],
105105 db : Annotated [AsyncSession , Depends (async_get_db )]
106- ):
106+ ) -> Dict [ str , str ] :
107107 db_user = await crud_users .get (db = db , schema_to_select = UserRead , username = username , is_deleted = False )
108108 if db_user is None :
109109 raise NotFoundException ("User not found" )
@@ -131,7 +131,7 @@ async def erase_post(
131131 id : int ,
132132 current_user : Annotated [UserRead , Depends (get_current_user )],
133133 db : Annotated [AsyncSession , Depends (async_get_db )]
134- ):
134+ ) -> Dict [ str , str ] :
135135 db_user = await crud_users .get (db = db , schema_to_select = UserRead , username = username , is_deleted = False )
136136 if db_user is None :
137137 raise NotFoundException ("User not found" )
@@ -159,7 +159,7 @@ async def erase_db_post(
159159 username : str ,
160160 id : int ,
161161 db : Annotated [AsyncSession , Depends (async_get_db )]
162- ):
162+ ) -> Dict [ str , str ] :
163163 db_user = await crud_users .get (db = db , schema_to_select = UserRead , username = username , is_deleted = False )
164164 if db_user is None :
165165 raise NotFoundException ("User not found" )
0 commit comments