The backend component to interface with the smart contract.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

user.py 516 B

2 months ago
1234567891011121314151617181920
  1. from typing import Optional
  2. from fastapi import APIRouter
  3. from uuid import uuid4
  4. from app.crud.user import add_user, get_user
  5. from app.db.session import get_db_session
  6. from app.schemas.user import User
  7. router = APIRouter()
  8. @router.post("/authenticate")
  9. async def authenticate(user: dict):
  10. session_id = uuid4()
  11. session_obj = user
  12. session_obj['session_id'] = str(session_id)
  13. async for session in get_db_session():
  14. await add_user(session, session_obj)
  15. return {'session_id': session_id}