Skip to content
Open
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 @@ -47,6 +47,13 @@ repos:
language: unsupported
pass_filenames: false

- id: local-ty
name: ty check
entry: uv run ty check 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 @@ -63,6 +63,7 @@ def run_migrations_online():

"""
configuration = config.get_section(config.config_ini_section)
assert configuration is not None
configuration["sqlalchemy.url"] = get_url()
connectable = engine_from_config(
configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def upgrade():

def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'item', type_='foreignkey')
op.drop_constraint('item_owner_id_fkey', 'item', type_='foreignkey')
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little confused about this one, as drop_constraint requires a str constraint name. Not sure why it was None before and I don't see how it would have worked. Feels like this is an actual bug fix? 🤔

op.create_foreign_key('item_owner_id_fkey', 'item', 'user', ['owner_id'], ['id'])
op.alter_column('item', 'owner_id',
existing_type=sa.UUID(),
Expand Down
3 changes: 2 additions & 1 deletion backend/app/api/routes/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def read_items(
)
items = session.exec(statement).all()

return ItemsPublic(data=items, count=count)
items_public = [ItemPublic.model_validate(item) for item in items]
return ItemsPublic(data=items_public, count=count)


@router.get("/{id}", response_model=ItemPublic)
Expand Down
3 changes: 2 additions & 1 deletion backend/app/api/routes/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def read_users(session: SessionDep, skip: int = 0, limit: int = 100) -> Any:
)
users = session.exec(statement).all()

return UsersPublic(data=users, count=count)
users_public = [UserPublic.model_validate(user) for user in users]
return UsersPublic(data=users_public, count=count)


@router.post(
Expand Down
4 changes: 2 additions & 2 deletions backend/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UserRegister(SQLModel):

# Properties to receive via API on update, all are optional
class UserUpdate(UserBase):
email: EmailStr | None = Field(default=None, max_length=255) # type: ignore
email: EmailStr | None = Field(default=None, max_length=255) # type: ignore[assignment]
password: str | None = Field(default=None, min_length=8, max_length=128)


Expand Down Expand Up @@ -80,7 +80,7 @@ class ItemCreate(ItemBase):

# Properties to receive on item update
class ItemUpdate(ItemBase):
title: str | None = Field(default=None, min_length=1, max_length=255) # type: ignore
title: str | None = Field(default=None, min_length=1, max_length=255) # type: ignore[assignment]


# Database model, database table inferred from class name
Expand Down
2 changes: 1 addition & 1 deletion backend/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
from typing import Any

import emails # type: ignore
import emails # type: ignore[import-untyped]
import jwt
from jinja2 import Template
from jwt.exceptions import InvalidTokenError
Expand Down
4 changes: 4 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies = [
dev = [
"pytest<8.0.0,>=7.4.3",
"mypy<2.0.0,>=1.8.0",
"ty>=0.0.25",
"ruff<1.0.0,>=0.2.2",
"prek>=0.2.24,<1.0.0",
"coverage<8.0.0,>=7.4.3",
Expand Down Expand Up @@ -75,3 +76,6 @@ sort = "-Cover"

[tool.coverage.html]
show_contexts = true

[tool.ty.terminal]
error-on-warning = true
1 change: 1 addition & 0 deletions backend/scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ set -e
set -x

mypy app
ty check app
ruff check app
ruff format app --check
26 changes: 26 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading