23 lines
636 B
Python
23 lines
636 B
Python
# scopes.api.tracking
|
|
|
|
"""basic (generic) routes and views for tracks (records)"""
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from fastapi.responses import HTMLResponse
|
|
import transaction
|
|
from typing import Annotated
|
|
|
|
from scopes.api import deps
|
|
from scopes.storage import tracking
|
|
from scopes.storage.common import Storage
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get('/tracks')
|
|
async def get_tracks(storage: Annotated[Storage, Depends(deps.storage)]):
|
|
tracks = storage.create(tracking.Container)
|
|
result = [tr.asDict() for tr in tracks.query()]
|
|
#result = [Track(tr) for tr in tracks.query()]
|
|
transaction.commit()
|
|
return result
|
|
|