Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Install dependencies
run: bun ci
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v8
uses: actions/download-artifact@v7
Comment thread
svlandeg marked this conversation as resolved.
Outdated
with:
path: frontend/all-blob-reports
pattern: blob-report-*
Expand Down
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? 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm confused too, this is generated automatically, don't really know what it might be... but also, all the other op.drop_constraint() calls have a name, and tests seem to pass, so we're probably good. ✔️

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
6 changes: 3 additions & 3 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Settings(BaseSettings):
list[AnyUrl] | str, BeforeValidator(parse_cors)
] = []

@computed_field # type: ignore[prop-decorator]
@computed_field # type: ignore[prop-decorator] # ty: ignore[unused-ignore-comment]
@property
def all_cors_origins(self) -> list[str]:
return [str(origin).rstrip("/") for origin in self.BACKEND_CORS_ORIGINS] + [
Expand All @@ -56,7 +56,7 @@ def all_cors_origins(self) -> list[str]:
POSTGRES_PASSWORD: str = ""
POSTGRES_DB: str = ""

@computed_field # type: ignore[prop-decorator]
@computed_field # type: ignore[prop-decorator] # ty: ignore[unused-ignore-comment]
@property
def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn:
return PostgresDsn.build(
Expand Down Expand Up @@ -85,7 +85,7 @@ def _set_default_emails_from(self) -> Self:

EMAIL_RESET_TOKEN_EXPIRE_HOURS: int = 48

@computed_field # type: ignore[prop-decorator]
@computed_field # type: ignore[prop-decorator] # ty: ignore[unused-ignore-comment]
@property
def emails_enabled(self) -> bool:
return bool(self.SMTP_HOST and self.EMAILS_FROM_EMAIL)
Expand Down
2 changes: 1 addition & 1 deletion backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def custom_generate_unique_id(route: APIRoute) -> str:
# Set all CORS enabled origins
if settings.all_cors_origins:
app.add_middleware(
CORSMiddleware,
CORSMiddleware, # ty: ignore
allow_origins=settings.all_cors_origins,
allow_credentials=True,
allow_methods=["*"],
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 # ty: ignore[unused-ignore-comment]
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 # ty: ignore[unused-ignore-comment]


# 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 # ty: ignore[unused-ignore-comment]
import jwt
from jinja2 import Template
from jwt.exceptions import InvalidTokenError
Expand Down
1 change: 1 addition & 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.9",
"ruff<1.0.0,>=0.2.2",
"prek>=0.2.24,<1.0.0",
"coverage<8.0.0,>=7.4.3",
Expand Down
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 app
Comment thread
svlandeg marked this conversation as resolved.
Outdated
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.