Renamed folder from example -> aggregate
This commit is contained in:
21
src/aggregate/aggregate_router.py
Normal file
21
src/aggregate/aggregate_router.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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)
|
||||
Reference in New Issue
Block a user