From 6517fc5db2dac325028bdb94f937333e9fd42b25 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 28 Dec 2020 09:35:27 +0200 Subject: [PATCH] More route tags to a central place. --- etebase_fastapi/app.py | 12 ++++++------ etebase_fastapi/authentication.py | 2 +- etebase_fastapi/collection.py | 4 ++-- etebase_fastapi/invitation.py | 4 ++-- etebase_fastapi/member.py | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/etebase_fastapi/app.py b/etebase_fastapi/app.py index a8b12d0..2bbfc2a 100644 --- a/etebase_fastapi/app.py +++ b/etebase_fastapi/app.py @@ -22,12 +22,12 @@ app = FastAPI() VERSION = "v1" BASE_PATH = f"/api/{VERSION}" COLLECTION_UID_MARKER = "{collection_uid}" -app.include_router(authentication_router, prefix=f"{BASE_PATH}/authentication") -app.include_router(collection_router, prefix=f"{BASE_PATH}/collection") -app.include_router(item_router, prefix=f"{BASE_PATH}/collection/{COLLECTION_UID_MARKER}") -app.include_router(member_router, prefix=f"{BASE_PATH}/collection/{COLLECTION_UID_MARKER}") -app.include_router(invitation_incoming_router, prefix=f"{BASE_PATH}/invitation/incoming") -app.include_router(invitation_outgoing_router, prefix=f"{BASE_PATH}/invitation/outgoing") +app.include_router(authentication_router, prefix=f"{BASE_PATH}/authentication", tags=["authentication"]) +app.include_router(collection_router, prefix=f"{BASE_PATH}/collection", tags=["collection"]) +app.include_router(item_router, prefix=f"{BASE_PATH}/collection/{COLLECTION_UID_MARKER}", tags=["item"]) +app.include_router(member_router, prefix=f"{BASE_PATH}/collection/{COLLECTION_UID_MARKER}", tags=["member"]) +app.include_router(invitation_incoming_router, prefix=f"{BASE_PATH}/invitation/incoming", tags=["incoming invitation"]) +app.include_router(invitation_outgoing_router, prefix=f"{BASE_PATH}/invitation/outgoing", tags=["outgoing invitation"]) if settings.DEBUG: from .test_reset_view import test_reset_view_router diff --git a/etebase_fastapi/authentication.py b/etebase_fastapi/authentication.py index 13a8884..742f101 100644 --- a/etebase_fastapi/authentication.py +++ b/etebase_fastapi/authentication.py @@ -33,7 +33,7 @@ User = get_user_model() token_scheme = APIKeyHeader(name="Authorization") AUTO_REFRESH = True MIN_REFRESH_INTERVAL = 60 -authentication_router = APIRouter(route_class=MsgpackRoute, tags=["authentication"]) +authentication_router = APIRouter(route_class=MsgpackRoute) @dataclasses.dataclass(frozen=True) diff --git a/etebase_fastapi/collection.py b/etebase_fastapi/collection.py index 993d144..8b69708 100644 --- a/etebase_fastapi/collection.py +++ b/etebase_fastapi/collection.py @@ -17,8 +17,8 @@ from .stoken_handler import filter_by_stoken_and_limit, filter_by_stoken, get_st from .utils import get_object_or_404, Context, Prefetch, PrefetchQuery, is_collection_admin, BaseModel User = get_user_model() -collection_router = APIRouter(route_class=MsgpackRoute, tags=["collection"]) -item_router = APIRouter(route_class=MsgpackRoute, tags=["item"]) +collection_router = APIRouter(route_class=MsgpackRoute) +item_router = APIRouter(route_class=MsgpackRoute) default_queryset: QuerySet = models.Collection.objects.all() default_item_queryset: QuerySet = models.CollectionItem.objects.all() diff --git a/etebase_fastapi/invitation.py b/etebase_fastapi/invitation.py index 5c2c338..ab0bf01 100644 --- a/etebase_fastapi/invitation.py +++ b/etebase_fastapi/invitation.py @@ -13,8 +13,8 @@ from .msgpack import MsgpackRoute from .utils import get_object_or_404, Context, is_collection_admin, BaseModel User = get_user_model() -invitation_incoming_router = APIRouter(route_class=MsgpackRoute, tags=["incoming invitation"]) -invitation_outgoing_router = APIRouter(route_class=MsgpackRoute, tags=["outgoing invitation"]) +invitation_incoming_router = APIRouter(route_class=MsgpackRoute) +invitation_outgoing_router = APIRouter(route_class=MsgpackRoute) default_queryset: QuerySet = models.CollectionInvitation.objects.all() diff --git a/etebase_fastapi/member.py b/etebase_fastapi/member.py index 749092c..26cfcff 100644 --- a/etebase_fastapi/member.py +++ b/etebase_fastapi/member.py @@ -14,7 +14,7 @@ from .stoken_handler import filter_by_stoken_and_limit from .collection import get_collection, verify_collection_admin User = get_user_model() -member_router = APIRouter(route_class=MsgpackRoute, tags=["member"]) +member_router = APIRouter(route_class=MsgpackRoute) default_queryset: QuerySet = models.CollectionMember.objects.all()