|
- from typing import Optional
-
- from fastapi import APIRouter
- from uuid import uuid4
-
- from app.crud.user import add_user, get_user
- from app.db.session import get_db_session
- from app.schemas.user import User
-
- router = APIRouter()
-
-
- @router.post("/authenticate")
- async def authenticate(user: dict):
- session_id = uuid4()
- session_obj = user
- session_obj['session_id'] = str(session_id)
- async for session in get_db_session():
- await add_user(session, session_obj)
- return {'session_id': session_id}
|