From c9ea27c8b02cc87ba626a4e23f8d568261a7fdeb Mon Sep 17 00:00:00 2001 From: Jack Jackson Date: Tue, 6 May 2025 00:56:29 +0100 Subject: [PATCH 1/2] bugs life --- backend/app/crud.py | 1 - backend/app/main.py | 1 - backend/app/utils.py | 1 - 3 files changed, 3 deletions(-) diff --git a/backend/app/crud.py b/backend/app/crud.py index 905bf48..4eaf87a 100644 --- a/backend/app/crud.py +++ b/backend/app/crud.py @@ -50,5 +50,4 @@ def create_item(*, session: Session, item_in: ItemCreate, owner_id: uuid.UUID) - db_item = Item.model_validate(item_in, update={"owner_id": owner_id}) session.add(db_item) session.commit() - session.refresh(db_item) return db_item diff --git a/backend/app/main.py b/backend/app/main.py index 9a95801..d158e10 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -15,7 +15,6 @@ def custom_generate_unique_id(route: APIRoute) -> str: sentry_sdk.init(dsn=str(settings.SENTRY_DSN), enable_tracing=True) app = FastAPI( - title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json", generate_unique_id_function=custom_generate_unique_id, ) diff --git a/backend/app/utils.py b/backend/app/utils.py index ac029f6..0efa7f5 100644 --- a/backend/app/utils.py +++ b/backend/app/utils.py @@ -59,7 +59,6 @@ def generate_test_email(email_to: str) -> EmailData: project_name = settings.PROJECT_NAME subject = f"{project_name} - Test email" html_content = render_email_template( - template_name="test_email.html", context={"project_name": settings.PROJECT_NAME, "email": email_to}, ) return EmailData(html_content=html_content, subject=subject) From 23ccb4208dab27a52d1c7596c1b2b9c105273a4c Mon Sep 17 00:00:00 2001 From: Jack Jackson Date: Tue, 6 May 2025 01:00:41 +0100 Subject: [PATCH 2/2] ok --- backend/app/crud.py | 1 + backend/app/main.py | 10 ++++++++++ backend/app/utils.py | 1 + 3 files changed, 12 insertions(+) diff --git a/backend/app/crud.py b/backend/app/crud.py index 4eaf87a..905bf48 100644 --- a/backend/app/crud.py +++ b/backend/app/crud.py @@ -50,4 +50,5 @@ def create_item(*, session: Session, item_in: ItemCreate, owner_id: uuid.UUID) - db_item = Item.model_validate(item_in, update={"owner_id": owner_id}) session.add(db_item) session.commit() + session.refresh(db_item) return db_item diff --git a/backend/app/main.py b/backend/app/main.py index d158e10..2ec05d7 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -15,10 +15,20 @@ def custom_generate_unique_id(route: APIRoute) -> str: sentry_sdk.init(dsn=str(settings.SENTRY_DSN), enable_tracing=True) app = FastAPI( + title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json", generate_unique_id_function=custom_generate_unique_id, ) +class User(BaseModel): + username: str + +user_dependency = User(username="admin") + +@app.get("/broken-endpoint") +def read_user(user: User = Depends(user_dependency)): + return {"user": user} + # Set all CORS enabled origins if settings.all_cors_origins: app.add_middleware( diff --git a/backend/app/utils.py b/backend/app/utils.py index 0efa7f5..ac029f6 100644 --- a/backend/app/utils.py +++ b/backend/app/utils.py @@ -59,6 +59,7 @@ def generate_test_email(email_to: str) -> EmailData: project_name = settings.PROJECT_NAME subject = f"{project_name} - Test email" html_content = render_email_template( + template_name="test_email.html", context={"project_name": settings.PROJECT_NAME, "email": email_to}, ) return EmailData(html_content=html_content, subject=subject)