22 lines
570 B
Python
22 lines
570 B
Python
# contains the router for the aggregates endpoint
|
|
from fastapi import APIRouter, Query
|
|
from enum import Enum
|
|
from typing import List
|
|
from .aggregate_schema import AggregateSchema
|
|
from .aggregate_service import get_aggregates
|
|
|
|
|
|
class MetricEnum(str, Enum):
|
|
relative = "relative"
|
|
absolute = "absolute"
|
|
|
|
|
|
router = APIRouter(tags=["aggregates"])
|
|
|
|
|
|
@router.get("/aggregates", response_model=List[AggregateSchema])
|
|
async def aggregates_endpoint(
|
|
metric: MetricEnum = Query(MetricEnum.relative, description="Metric type")
|
|
):
|
|
return await get_aggregates(metric)
|