More route tags to a central place.

master
Tom Hacohen 4 years ago
parent 80d69a5663
commit 6517fc5db2

@ -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

@ -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)

@ -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()

@ -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()

@ -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()

Loading…
Cancel
Save