25 lines
957 B
Python
25 lines
957 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
import aiosqlite
|
|
from fastapi import APIRouter, Depends, Request
|
|
|
|
import persons
|
|
from common import ProblemDetails
|
|
from main import get_db, cookie_person # temporary during extraction
|
|
|
|
router = APIRouter(prefix="/auth", tags=["auth"])
|
|
|
|
|
|
@router.post("/login", operation_id="login", summary="Login and set user_id cookie",
|
|
responses={404: {"model": ProblemDetails, "description": "Person not found", "content": {"application/problem+json": {}}}})
|
|
async def login(
|
|
data: Any, conn: aiosqlite.Connection = Depends(get_db), request: Request | None = None
|
|
) -> persons.Person:
|
|
raise NotImplementedError("login extraction pending")
|
|
|
|
|
|
@router.post("/refresh", operation_id="refresh", summary="Refresh current user from cookie")
|
|
async def current_user(user: persons.Person = Depends(cookie_person)) -> persons.Person:
|
|
raise NotImplementedError("current_user extraction pending")
|