from typing import List

from fastapi import APIRouter

from src.db.models.admin import Token
from src.db.session import SessionDep
from src.schema.user.token import TokenResponse, to_response

router = APIRouter()


@router.get("/tokens", response_model=List[TokenResponse])
def get_all_profiles(db: SessionDep) -> List[TokenResponse]:
    results: List[TokenResponse] = []
    tokens = db.query(Token).all()
    for token in tokens:
        response = to_response(token)
        results.append(response)
    return results
