Spaces:
Running on T4
Running on T4
Download backend/app/modules/accounts/controller.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 897 Bytes
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/accounts/controller.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/accounts/controller.py
-
curl -L -o controller.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/accounts/controller.py
897 Bytes
| """B1 GET /me, B2 PATCH /me, B5 DELETE /me.""" | |
| from fastapi import APIRouter, Response | |
| from app.core.dependencies import CurrentAccount, Db, Storage | |
| from app.modules.accounts.schemas import MeOut, MeUpdate, UserBody | |
| from app.modules.accounts.service import AccountService | |
| router = APIRouter(prefix="/v1", tags=["accounts"]) | |
| async def get_me(db: Db, account: CurrentAccount) -> MeOut: | |
| return await AccountService(db).me(account) | |
| async def update_me(body: MeUpdate, db: Db, account: CurrentAccount) -> UserBody: | |
| return UserBody(user=await AccountService(db).update(account, body)) | |
| async def delete_me(db: Db, storage: Storage, account: CurrentAccount) -> Response: | |
| await AccountService(db, storage).delete(account) | |
| return Response(status_code=204) | |