Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /JeanExtreme002_Dokku-API /src /api /routers /admin /apps.py
| from fastapi import APIRouter, Depends, FastAPI, Request, status | |
| from fastapi.responses import JSONResponse | |
| from sqlalchemy.ext.asyncio import AsyncSession | |
| from src.api.models import get_db_session, get_user | |
| from src.api.services import AppService | |
| def get_router(app: FastAPI) -> APIRouter: | |
| router = APIRouter() | |
| async def set_owner( | |
| request: Request, | |
| email: str, | |
| app_name: str, | |
| db_session: AsyncSession = Depends(get_db_session), | |
| ): | |
| user = await get_user(email, db_session) | |
| await AppService.set_owner(user, app_name, db_session) | |
| return JSONResponse(status_code=status.HTTP_200_OK, content={}) | |
| async def unset_owner( | |
| request: Request, | |
| email: str, | |
| app_name: str, | |
| db_session: AsyncSession = Depends(get_db_session), | |
| ): | |
| user = await get_user(email, db_session) | |
| await AppService.unset_owner(user, app_name, db_session) | |
| return JSONResponse(status_code=status.HTTP_200_OK, content={}) | |
| async def list_storage( | |
| email: str, | |
| app_name: str, | |
| db_session: AsyncSession = Depends(get_db_session), | |
| ): | |
| user = await get_user(email, db_session) | |
| success, result = await AppService.list_storage(user, app_name) | |
| return JSONResponse( | |
| status_code=status.HTTP_200_OK, | |
| content={"success": success, "result": result}, | |
| ) | |
| async def mount_storage( | |
| email: str, | |
| app_name: str, | |
| directory: str = "/app/storage", | |
| db_session: AsyncSession = Depends(get_db_session), | |
| ): | |
| user = await get_user(email, db_session) | |
| success, result = await AppService.mount_storage(user, app_name, directory) | |
| return JSONResponse( | |
| status_code=status.HTTP_200_OK, | |
| content={"success": success, "result": result}, | |
| ) | |
| async def unmount_storage( | |
| email: str, | |
| app_name: str, | |
| directory: str = "/app/storage", | |
| db_session: AsyncSession = Depends(get_db_session), | |
| ): | |
| user = await get_user(email, db_session) | |
| success, result = await AppService.unmount_storage(user, app_name, directory) | |
| return JSONResponse( | |
| status_code=status.HTTP_200_OK, | |
| content={"success": success, "result": result}, | |
| ) | |
| return router | |
Xet Storage Details
- Size:
- 2.95 kB
- Xet hash:
- 8f12093901346c30bc9a72366301994169333a78b37367d117fc3d0b72bddc28
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.