From 615d290773bd0fd1c55fab60a5a138a1f1e1ff3e Mon Sep 17 00:00:00 2001 From: Pascal Scheiben Date: Thu, 18 Sep 2025 10:23:40 +0200 Subject: [PATCH] Renamed folder from example -> aggregate --- src/{example => aggregate}/__init__.py | 0 src/{example => aggregate}/aggregate_router.py | 2 +- src/{example => aggregate}/aggregate_schema.py | 0 src/{example => aggregate}/aggregate_service.py | 12 +++++++++--- src/{example => aggregate}/constants.py | 0 src/{example => aggregate}/router.py | 4 ++-- src/{example => aggregate}/schema.py | 2 +- src/aggregate/service.py | 3 +++ src/example/service.py | 3 --- src/main.py | 3 ++- 10 files changed, 18 insertions(+), 11 deletions(-) rename src/{example => aggregate}/__init__.py (100%) rename src/{example => aggregate}/aggregate_router.py (97%) rename src/{example => aggregate}/aggregate_schema.py (100%) rename src/{example => aggregate}/aggregate_service.py (57%) rename src/{example => aggregate}/constants.py (100%) rename src/{example => aggregate}/router.py (69%) rename src/{example => aggregate}/schema.py (64%) create mode 100644 src/aggregate/service.py delete mode 100644 src/example/service.py diff --git a/src/example/__init__.py b/src/aggregate/__init__.py similarity index 100% rename from src/example/__init__.py rename to src/aggregate/__init__.py diff --git a/src/example/aggregate_router.py b/src/aggregate/aggregate_router.py similarity index 97% rename from src/example/aggregate_router.py rename to src/aggregate/aggregate_router.py index 90f7c11..b33556b 100644 --- a/src/example/aggregate_router.py +++ b/src/aggregate/aggregate_router.py @@ -16,6 +16,6 @@ router = APIRouter(tags=["aggregates"]) @router.get("/aggregates", response_model=List[AggregateSchema]) async def aggregates_endpoint( - metric: MetricEnum = Query(MetricEnum.relative, description="Metric type") + metric: MetricEnum = Query(MetricEnum.relative, description="Metric type"), ): return await get_aggregates(metric) diff --git a/src/example/aggregate_schema.py b/src/aggregate/aggregate_schema.py similarity index 100% rename from src/example/aggregate_schema.py rename to src/aggregate/aggregate_schema.py diff --git a/src/example/aggregate_service.py b/src/aggregate/aggregate_service.py similarity index 57% rename from src/example/aggregate_service.py rename to src/aggregate/aggregate_service.py index 59daa94..0a40557 100644 --- a/src/example/aggregate_service.py +++ b/src/aggregate/aggregate_service.py @@ -10,9 +10,15 @@ async def get_aggregates(metric: str = "relative") -> List[AggregateSchema]: print(f"Metric used: {metric}") aggregates: list = [ - AggregateSchema(aggregate="Aggregate A", node="cluster01-01", available="100.0TB"), - AggregateSchema(aggregate="Aggregate B", node="cluster01-01", available="200.5GB"), - AggregateSchema(aggregate="Aggregate C", node="cluster01-02", available="300.75MB"), + AggregateSchema( + aggregate="Aggregate A", node="cluster01-01", available="100.0TB" + ), + AggregateSchema( + aggregate="Aggregate B", node="cluster01-01", available="200.5GB" + ), + AggregateSchema( + aggregate="Aggregate C", node="cluster01-02", available="300.75MB" + ), ] return aggregates diff --git a/src/example/constants.py b/src/aggregate/constants.py similarity index 100% rename from src/example/constants.py rename to src/aggregate/constants.py diff --git a/src/example/router.py b/src/aggregate/router.py similarity index 69% rename from src/example/router.py rename to src/aggregate/router.py index bfad513..4c5096d 100644 --- a/src/example/router.py +++ b/src/aggregate/router.py @@ -1,8 +1,8 @@ -# contains the router for the example endpoint +# contains the router for the aggregate endpoint from fastapi import APIRouter from .schema import ExampleSchema -router = APIRouter(tags=["example"]) +router = APIRouter(tags=["aggregate"]) @router.get("/example") diff --git a/src/example/schema.py b/src/aggregate/schema.py similarity index 64% rename from src/example/schema.py rename to src/aggregate/schema.py index 254a309..47392d6 100644 --- a/src/example/schema.py +++ b/src/aggregate/schema.py @@ -1,4 +1,4 @@ -# contains the schema definitions for the example service +# contains the schema definitions for the aggregate service from pydantic import BaseModel diff --git a/src/aggregate/service.py b/src/aggregate/service.py new file mode 100644 index 0000000..cd81419 --- /dev/null +++ b/src/aggregate/service.py @@ -0,0 +1,3 @@ +# contains the business logic for the aggregate service +async def example_service() -> str: + return "This is an aggregate service" diff --git a/src/example/service.py b/src/example/service.py deleted file mode 100644 index 0553df7..0000000 --- a/src/example/service.py +++ /dev/null @@ -1,3 +0,0 @@ -# contains the business logic for the example service -async def example_service() -> str: - return "This is an example service" diff --git a/src/main.py b/src/main.py index ada95be..8e902bf 100644 --- a/src/main.py +++ b/src/main.py @@ -1,7 +1,7 @@ from src.service import load_config from fastapi import FastAPI import logging -from src.example import aggregate_router +from src.aggregate import aggregate_router logger = logging.getLogger("uvicorn") @@ -11,6 +11,7 @@ config = load_config() app = FastAPI() app.include_router(aggregate_router) + @app.get("/") async def main(): return {"Hello": "World"}