mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-01-17 11:40:39 +03:00
apply sqlalchemy 2.0 declarative base and mapped columns
This commit is contained in:
@@ -10,7 +10,7 @@ router = APIRouter(prefix="/v1/nonsense")
|
||||
|
||||
@router.post("/", status_code=status.HTTP_201_CREATED, response_model=NonsenseResponse)
|
||||
async def create_nonsense(payload: NonsenseSchema, db_session: AsyncSession = Depends(get_db)):
|
||||
nonsense = Nonsense(**payload.dict())
|
||||
nonsense = Nonsense(**payload.model_dump())
|
||||
await nonsense.save(db_session)
|
||||
return nonsense
|
||||
|
||||
|
||||
Reference in New Issue
Block a user