From b67c9e98f581169fe9171f1655edaf3f8734c4d7 Mon Sep 17 00:00:00 2001 From: maxim-lixakov Date: Tue, 12 Nov 2024 16:56:28 +0300 Subject: [PATCH] [DOP-21268] - update RTD config --- .readthedocs.yaml | 2 +- syncmaster/backend/export_openapi_schema.py | 6 ++---- .../versions/2023-11-23_0001_create_user_table.py | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 3ce93aa9..f6b8364b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -17,7 +17,7 @@ build: - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry install --no-root --all-extras --with docs --without dev,test - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry show -v - python -m pip list -v - - SYNCMASTER__DATABASE__URL=postgresql+psycopg://fake:fake@127.0.0.1:5432/fake SYNCMASTER__BROKER__URL=amqp://fake:faket@fake:5672/ SYNCMASTER__CRYPTO_KEY=crypto_key python -m syncmaster.backend.export_openapi_schema docs/_static/openapi.json + - SYNCMASTER__DATABASE__URL=postgresql+psycopg://fake:fake@127.0.0.1:5432/fake SYNCMASTER__BROKER__URL=amqp://fake:faket@fake:5672/ SYNCMASTER__CRYPTO_KEY=crypto_key SYNCMASTER__AUTH__ACCESS_TOKEN__SECRET_KEY=fakepython python -m syncmaster.backend.export_openapi_schema docs/_static/openapi.json sphinx: configuration: docs/conf.py diff --git a/syncmaster/backend/export_openapi_schema.py b/syncmaster/backend/export_openapi_schema.py index 4f9513ad..fac804b4 100755 --- a/syncmaster/backend/export_openapi_schema.py +++ b/syncmaster/backend/export_openapi_schema.py @@ -7,8 +7,7 @@ from fastapi import FastAPI -from syncmaster.backend import application_factory -from syncmaster.backend.settings import BackendSettings as Settings +from syncmaster.backend import get_application def get_openapi_schema(app: FastAPI) -> dict: @@ -16,8 +15,7 @@ def get_openapi_schema(app: FastAPI) -> dict: if __name__ == "__main__": - settings = Settings() - app = application_factory(settings) + app = get_application() schema = get_openapi_schema(app) file_path = sys.argv[1] if not file_path: diff --git a/syncmaster/db/migrations/versions/2023-11-23_0001_create_user_table.py b/syncmaster/db/migrations/versions/2023-11-23_0001_create_user_table.py index caee463e..9603efa7 100644 --- a/syncmaster/db/migrations/versions/2023-11-23_0001_create_user_table.py +++ b/syncmaster/db/migrations/versions/2023-11-23_0001_create_user_table.py @@ -32,6 +32,7 @@ def upgrade(): sa.Column("updated_at", sa.DateTime(), server_default=sa.text("now()"), nullable=False), sa.Column("is_deleted", sa.Boolean(), nullable=False), sa.PrimaryKeyConstraint("id", name=op.f("pk__user")), + sa.UniqueConstraint("email", name=op.f("uq__user__email")), ) op.create_index(op.f("ix__user__username"), "user", ["username"], unique=True)