From 6973d0ecf474031c8abe058bd0ca58c9dcc7d377 Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Mon, 13 Nov 2023 18:59:29 +0100 Subject: [PATCH] fix: Fix documentation in production (#201) (#207) --- backend/app/api/api_v1/endpoints/adminmsgs.py | 7 +- backend/app/api/api_v1/endpoints/auth.py | 7 +- backend/app/api/api_v1/endpoints/caseinfo.py | 6 ++ backend/app/api/api_v1/endpoints/utils.py | 9 +- docs/conf.py | 7 ++ docs/requirements.txt | 99 ++++++++++++++++++- 6 files changed, 130 insertions(+), 5 deletions(-) diff --git a/backend/app/api/api_v1/endpoints/adminmsgs.py b/backend/app/api/api_v1/endpoints/adminmsgs.py index 28b6f4fc..ac253846 100644 --- a/backend/app/api/api_v1/endpoints/adminmsgs.py +++ b/backend/app/api/api_v1/endpoints/adminmsgs.py @@ -13,7 +13,12 @@ async def read_adminmsgs( skip: int = 0, limit: int = 100, ) -> list[schemas.AdminMessageRead]: - """Retrieve all admin messages""" + """ + Retrieve all admin messages. + + :return: list of admin messages + :rtype: list + """ users = [ schemas.AdminMessageRead.model_validate(db_obj) for db_obj in await crud.adminmessage.get_multi(db, skip=skip, limit=limit) diff --git a/backend/app/api/api_v1/endpoints/auth.py b/backend/app/api/api_v1/endpoints/auth.py index 2a39b1eb..653ff2f3 100644 --- a/backend/app/api/api_v1/endpoints/auth.py +++ b/backend/app/api/api_v1/endpoints/auth.py @@ -8,7 +8,12 @@ @router.get("/oauth2-providers", response_model=list[schemas.OAuth2ProviderPublic]) async def list_oauth2_providers() -> list[schemas.OAuth2ProviderPublic]: - """Retrieve all admin messages""" + """ + Retrieve all admin messages. + + :return: list of admin messages + :rtype: list + """ providers = [ schemas.OAuth2ProviderPublic.model_validate(obj.model_dump()) for obj in config.settings.OAUTH2_PROVIDERS diff --git a/backend/app/api/api_v1/endpoints/caseinfo.py b/backend/app/api/api_v1/endpoints/caseinfo.py index a28d7089..e909b96e 100644 --- a/backend/app/api/api_v1/endpoints/caseinfo.py +++ b/backend/app/api/api_v1/endpoints/caseinfo.py @@ -21,6 +21,7 @@ async def create_caseinfo( :param caseinfo: Case Information to create :type caseinfo: dict or :class:`.schemas.CaseInfoCreate` :return: Case Information + :rtype: dict """ caseinfo.user = user.id return await crud.caseinfo.create(db, obj_in=caseinfo) @@ -57,6 +58,7 @@ async def get_caseinfo(id: str, db: AsyncSession = Depends(deps.get_db)): :param id: Case Information id :type id: uuid :return: Case Information + :rtype: dict """ response = await crud.caseinfo.get(db, id=id) if not response: @@ -77,6 +79,7 @@ async def delete_caseinfo(id: str, db: AsyncSession = Depends(deps.get_db)): :param id: Case Information id :type id: uuid :return: Case Information + :rtype: dict """ response = await crud.caseinfo.remove(db, id=id) if not response: @@ -107,6 +110,7 @@ async def get_caseinfo_for_user( Get a Case Information for a current user. :return: Case Information + :rtype: dict """ caseinfo = await crud.caseinfo.get_by_user(db, user_id=user.id) if not caseinfo: @@ -127,6 +131,7 @@ async def update_caseinfo_for_user( :param caseinfo: Case Information to update :type caseinfo: dict or :class:`.schemas.CaseInfoUpdate` :return: Case Information + :rtype: dict """ caseinfoupdate.user = user.id caseinfo = await crud.caseinfo.get_by_user(db, user_id=user.id) @@ -143,6 +148,7 @@ async def delete_caseinfo_for_user( Delete a Case Information for a current user. :return: Case Information + :rtype: dict """ caseinfo = await crud.caseinfo.get_by_user(db, user_id=user.id) if not caseinfo: diff --git a/backend/app/api/api_v1/endpoints/utils.py b/backend/app/api/api_v1/endpoints/utils.py index a4d007b3..2a14da9f 100644 --- a/backend/app/api/api_v1/endpoints/utils.py +++ b/backend/app/api/api_v1/endpoints/utils.py @@ -17,6 +17,13 @@ dependencies=[Depends(current_active_superuser)], ) def test_email(email_to: EmailStr) -> Any: - """Send out a test email.""" + """ + Send out a test email. + + :param email_to: email address to send the test email to + :type email_to: str + :return: message + :rtype: dict + """ send_test_email(email_to=email_to) return {"msg": "Test email sent"} diff --git a/docs/conf.py b/docs/conf.py index db984f38..9ccef1c2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,6 +3,13 @@ # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +# -- Setting up backend for documentation------------------------------------- + +import os +import sys + +sys.path.insert(0, os.path.abspath("../backend")) + # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information diff --git a/docs/requirements.txt b/docs/requirements.txt index cbf1e365..f599a62c 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,97 @@ -sphinx -sphinx-rtd-theme +aiosqlite==0.19.0 +alabaster==0.7.13 +alembic==1.12.1 +annotated-types==0.6.0 +anyio==3.7.1 +async-timeout==4.0.3 +asyncpg==0.29.0 +Babel==2.13.1 +bcrypt==4.0.1 +black==23.10.1 +cachetools==5.3.2 +certifi==2023.7.22 +cffi==1.16.0 +chardet==5.2.0 +charset-normalizer==3.3.2 +click==8.1.7 +coverage==7.3.2 +cryptography==41.0.5 +cssselect==1.2.0 +cssutils==2.9.0 +dnspython==2.4.2 +docutils==0.18.1 +email-validator==2.0.0.post2 +emails==0.6 +exceptiongroup==1.1.3 +Faker==19.13.0 +fastapi==0.104.1 +fastapi-users==12.1.2 +fastapi-users-db-sqlalchemy==6.0.1 +flake8==6.1.0 +greenlet==3.0.1 +h11==0.14.0 +httpcore==0.17.3 +httpx +httpx-oauth +idna==3.4 +imagesize==1.4.1 +iniconfig==2.0.0 +install==1.3.5 +isort==5.12.0 +Jinja2==3.1.2 +lxml==4.9.3 +makefun==1.15.2 +Mako==1.3.0 +MarkupSafe==2.1.3 +mccabe==0.7.0 +mypy==1.6.1 +mypy-extensions==1.0.0 +packaging==23.2 +passlib==1.7.4 +pathspec==0.11.2 +platformdirs==3.11.0 +pluggy==1.3.0 +premailer==3.10.0 +psycopg2-binary==2.9.9 +pycodestyle==2.11.1 +pycparser==2.21 +pydantic==2.4.2 +pydantic-settings==2.0.3 +pydantic_core==2.10.1 +pyflakes==3.1.0 +Pygments==2.16.1 +PyJWT==2.8.0 +pytest==7.4.3 +pytest-asyncio==0.21.1 +pytest-cov==4.1.0 +pytest-faker==2.0.0 +pytest-httpx +pytest-subprocess==1.5.0 +python-dateutil==2.8.2 +python-dotenv==1.0.0 +python-multipart==0.0.6 +redis==5.0.1 +requests==2.31.0 +requests-mock==1.11.0 +six==1.16.0 +sniffio==1.3.0 +snowballstemmer==2.2.0 +Sphinx==7.2.6 +sphinx-rtd-theme==1.3.0 +sphinx-serve==1.0.1 +sphinxcontrib-applehelp==1.0.7 +sphinxcontrib-devhelp==1.0.5 +sphinxcontrib-htmlhelp==2.0.4 +sphinxcontrib-jquery==4.1 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==1.0.6 +sphinxcontrib-serializinghtml==1.1.9 +SQLAlchemy==2.0.23 +starlette==0.27.0 +tenacity==8.2.3 +tomli==2.0.1 +types-passlib==1.7.7.13 +types-requests==2.31.0.10 +typing_extensions==4.8.0 +urllib3==2.1.0 +uvicorn==0.24.0.post1