Skip to content

Commit

Permalink
feat: Integrate TanStack migration (#795) (#819)
Browse files Browse the repository at this point in the history
Co-authored-by: Manuel Holtgrewe <[email protected]>
  • Loading branch information
gromdimon and holtgrewe authored Sep 25, 2024
1 parent 6bd14db commit d88d283
Show file tree
Hide file tree
Showing 36 changed files with 28,847 additions and 13,454 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,35 @@ jobs:
- name: Lint source code
run: make -C backend lint

# Backend-Dump-OpenAPI:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# lfs: 'true'

# - name: Set up Python 3.10
# uses: actions/setup-python@v5
# with:
# python-version: "3.10"
# cache: "pipenv"
# cache-dependency-path: |
# backend/Pipfile.lock

# - name: Install pipenv and deps
# run: |
# python -m pip install --upgrade pipenv wheel
# make -C backend deps

# - name: Dump OpenAPI schema
# run: make -C backend ci-dump-openapi

# - name: Check for OpenAPI schema changes
# run: |
# diff backend/openapi.yaml backend/ci-openapi.yaml
# shell: bash -euo pipefail {0}

Backend-Test:
runs-on: ubuntu-latest
needs:
Expand Down
8 changes: 8 additions & 0 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,11 @@ alembic-autogenerate:
.PHONY: alembic-upgrade
alembic-upgrade:
pipenv run alembic upgrade head

.PHONY: dump-openapi
dump-openapi:
pipenv run python -c "from app.etc.utils import dump_openapi_schema; dump_openapi_schema('openapi.yaml')"

.PHONY: ci-dump-openapi
ci-dump-openapi:
pipenv run python -c "from app.etc.utils import dump_openapi_schema; dump_openapi_schema('ci-openapi.yaml')"
1 change: 1 addition & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ asgiref = "*"
tomli = "*"
exceptiongroup = "*"
async-timeout = "*"
types-pyyaml = "*"

[dev-packages]
aiosqlite = "*"
Expand Down
400 changes: 200 additions & 200 deletions backend/Pipfile.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions backend/app/etc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, Dict

import emails
import yaml
from emails.template import JinjaTemplate
from starlette.requests import Request

Expand Down Expand Up @@ -67,3 +68,11 @@ def send_user_verify_email(email_to: str, token: str, request: Request | None =
"base_url": base_url,
},
)


def dump_openapi_schema(path_out: str):
"""Dump the OpenAPI schema to a file"""
from app.main import app

with open(path_out, "wt") as f:
yaml.dump(app.openapi(), f)
Loading

0 comments on commit d88d283

Please sign in to comment.