- Added all seven issued service trees without omissions. - Preserved the supplied runtime configuration, binaries, and assets.
23 lines
672 B
Python
Executable File
23 lines
672 B
Python
Executable File
from fastapi import APIRouter
|
|
|
|
from backend.app.db import operations
|
|
from backend.app.api.schemas import ReadingIn
|
|
|
|
router = APIRouter(prefix="/api", tags=["readings"])
|
|
|
|
@router.get("/resources")
|
|
async def resources():
|
|
return await operations.resources()
|
|
|
|
@router.get("/readings")
|
|
async def readings():
|
|
return await operations.readings()
|
|
|
|
@router.get("/readings/{reading_id}")
|
|
async def reading_public(reading_id: int):
|
|
return await operations.reading_public(reading_id)
|
|
|
|
@router.post("/readings", status_code=201)
|
|
async def reading_add(body: ReadingIn):
|
|
return await operations.add_reading(body.serial, body.kind, body.model_dump(mode="json")["metrics"])
|