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- Generic single-database configuration with an async dbapi.
1+ Generic single-database configuration with an async dbapi.
Original file line number Diff line number Diff line change 11"""initialize models
22
33Revision ID: cd5b3c3d1cd2
4- Revises:
4+ Revises:
55Create Date: 2026-04-28 01:24:30.407103
66
77"""
Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ async def read_items(
5050
5151
5252@router .get ("/{id}" , response_model = ItemPublic )
53- async def read_item (session : SessionDep , current_user : CurrentUser , id : uuid .UUID ) -> Any :
53+ async def read_item (
54+ session : SessionDep , current_user : CurrentUser , id : uuid .UUID
55+ ) -> Any :
5456 """
5557 Get item by ID.
5658 """
Original file line number Diff line number Diff line change @@ -89,7 +89,9 @@ async def update_user_me(
8989 """
9090
9191 if user_in .email :
92- existing_user = await crud .get_user_by_email (session = session , email = user_in .email )
92+ existing_user = await crud .get_user_by_email (
93+ session = session , email = user_in .email
94+ )
9395 if existing_user and existing_user .id != current_user .id :
9496 raise HTTPException (
9597 status_code = 409 , detail = "User with this email already exists"
@@ -203,7 +205,9 @@ async def update_user(
203205 detail = "The user with this id does not exist in the system" ,
204206 )
205207 if user_in .email :
206- existing_user = await crud .get_user_by_email (session = session , email = user_in .email )
208+ existing_user = await crud .get_user_by_email (
209+ session = session , email = user_in .email
210+ )
207211 if existing_user and existing_user .id != user_id :
208212 raise HTTPException (
209213 status_code = 409 , detail = "User with this email already exists"
@@ -227,7 +231,6 @@ async def delete_user(
227231 raise HTTPException (
228232 status_code = 403 , detail = "Super users are not allowed to delete themselves"
229233 )
230- from sqlmodel import delete
231234
232235 statement = delete (Item ).where (col (Item .owner_id ) == user_id )
233236 await session .execute (statement )
Original file line number Diff line number Diff line change @@ -36,9 +36,7 @@ async def update_user(
3636 return db_user
3737
3838
39- async def get_user_by_email (
40- * , session : AsyncSession , email : str
41- ) -> User | None :
39+ async def get_user_by_email (* , session : AsyncSession , email : str ) -> User | None :
4240 statement = select (User ).where (User .email == email )
4341 result = await session .execute (statement )
4442 return result .scalars ().first ()
You can’t perform that action at this time.
0 commit comments