Skip to content

Commit 9551f89

Browse files
🎨 Auto format and update with pre-commit
1 parent 43cddb7 commit 9551f89

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

backend/app/alembic/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Generic single-database configuration with an async dbapi.
1+
Generic single-database configuration with an async dbapi.

backend/app/alembic/versions/cd5b3c3d1cd2_initialize_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""initialize models
22
33
Revision ID: cd5b3c3d1cd2
4-
Revises:
4+
Revises:
55
Create Date: 2026-04-28 01:24:30.407103
66
77
"""

backend/app/api/routes/items.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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
"""

backend/app/api/routes/users.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

backend/app/crud.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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()

0 commit comments

Comments
 (0)