|
|
@ -12,9 +12,10 @@ from .member import member_router
|
|
|
|
from .invitation import invitation_incoming_router, invitation_outgoing_router
|
|
|
|
from .invitation import invitation_incoming_router, invitation_outgoing_router
|
|
|
|
from .msgpack import MsgpackResponse
|
|
|
|
from .msgpack import MsgpackResponse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_application(prefix=""):
|
|
|
|
app = FastAPI()
|
|
|
|
app = FastAPI()
|
|
|
|
VERSION = "v1"
|
|
|
|
VERSION = "v1"
|
|
|
|
BASE_PATH = f"/api/{VERSION}"
|
|
|
|
BASE_PATH = f"{prefix}/api/{VERSION}"
|
|
|
|
COLLECTION_UID_MARKER = "{collection_uid}"
|
|
|
|
COLLECTION_UID_MARKER = "{collection_uid}"
|
|
|
|
app.include_router(authentication_router, prefix=f"{BASE_PATH}/authentication", tags=["authentication"])
|
|
|
|
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(collection_router, prefix=f"{BASE_PATH}/collection", tags=["collection"])
|
|
|
@ -37,3 +38,4 @@ app.add_middleware(TrustedHostMiddleware, allowed_hosts=settings.ALLOWED_HOSTS)
|
|
|
|
@app.exception_handler(CustomHttpException)
|
|
|
|
@app.exception_handler(CustomHttpException)
|
|
|
|
async def custom_exception_handler(request: Request, exc: CustomHttpException):
|
|
|
|
async def custom_exception_handler(request: Request, exc: CustomHttpException):
|
|
|
|
return MsgpackResponse(status_code=exc.status_code, content=exc.as_dict)
|
|
|
|
return MsgpackResponse(status_code=exc.status_code, content=exc.as_dict)
|
|
|
|
|
|
|
|
return app
|
|
|
|