Щербацевич-БПИ2302-на 3

This commit is contained in:
2026-11-27 21:28:16 +03:00
parent 20afc2c790
commit bd3a530df3
119 changed files with 10026 additions and 18 deletions
+19
View File
@@ -0,0 +1,19 @@
from fastapi import APIRouter, Depends
from app.crud.users import create_user
from app.deps import get_current_user
from app.present import PublicUser
from app.schemas.user import CreateUser, UserOut
router = APIRouter()
@router.post("/users", status_code=201, response_model=UserOut)
async def register(body: CreateUser) -> dict:
user = await create_user(body.username, body.display_name, body.password)
return user.to_dict()
@router.get("/users/me", response_model=UserOut)
async def me(user: PublicUser = Depends(get_current_user)) -> dict:
return user.to_dict()