Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ repos:
language: unsupported
types: [python]

- id: local-mypy
name: mypy check
entry: uv run mypy backend/app
require_serial: true
language: unsupported
pass_filenames: false

- id: generate-frontend-sdk
name: Generate Frontend SDK
entry: bash ./scripts/generate-client.sh
Expand Down
1 change: 1 addition & 0 deletions backend/app/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# Interpret the config file for Python logging.
# This line sets up loggers basically.
assert config.config_file_name is not None
fileConfig(config.config_file_name)

# add your model's MetaData object here
Expand Down
6 changes: 3 additions & 3 deletions backend/app/api/routes/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any

from fastapi import APIRouter, HTTPException
from sqlmodel import func, select
from sqlmodel import col, func, select

from app.api.deps import CurrentUser, SessionDep
from app.models import Item, ItemCreate, ItemPublic, ItemsPublic, ItemUpdate, Message
Expand All @@ -22,7 +22,7 @@ def read_items(
count_statement = select(func.count()).select_from(Item)
count = session.exec(count_statement).one()
statement = (
select(Item).order_by(Item.created_at.desc()).offset(skip).limit(limit)
select(Item).order_by(col(Item.created_at).desc()).offset(skip).limit(limit)
)
items = session.exec(statement).all()
else:
Expand All @@ -35,7 +35,7 @@ def read_items(
statement = (
select(Item)
.where(Item.owner_id == current_user.id)
.order_by(Item.created_at.desc())
.order_by(col(Item.created_at).desc())
.offset(skip)
.limit(limit)
)
Expand Down
6 changes: 4 additions & 2 deletions backend/app/api/routes/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def read_users(session: SessionDep, skip: int = 0, limit: int = 100) -> Any:
count_statement = select(func.count()).select_from(User)
count = session.exec(count_statement).one()

statement = select(User).order_by(User.created_at.desc()).offset(skip).limit(limit)
statement = (
select(User).order_by(col(User.created_at).desc()).offset(skip).limit(limit)
)
users = session.exec(statement).all()

return UsersPublic(data=users, count=count)
Expand Down Expand Up @@ -223,7 +225,7 @@ def delete_user(
status_code=403, detail="Super users are not allowed to delete themselves"
)
statement = delete(Item).where(col(Item.owner_id) == user_id)
session.exec(statement) # type: ignore
session.exec(statement)
session.delete(user)
session.commit()
return Message(message="User deleted successfully")