diff --git a/server/api/code/lacity_data_api/models/schemas.py b/server/api/code/lacity_data_api/models/api_models.py similarity index 97% rename from server/api/code/lacity_data_api/models/schemas.py rename to server/api/code/lacity_data_api/models/api_models.py index 74abb33b6..c8a63fff3 100644 --- a/server/api/code/lacity_data_api/models/schemas.py +++ b/server/api/code/lacity_data_api/models/api_models.py @@ -141,6 +141,12 @@ class Config: } +class TypeCount(APIModel): + type_id: int + type_name: str + type_count: int + + class RequestType(APIModel): type_id: int type_name: str @@ -188,3 +194,4 @@ class Config: ClusterList = List[Cluster] PinList = List[Pin] PointList = List[Point] +TypeCountList = List[TypeCount] diff --git a/server/api/code/lacity_data_api/routers/councils.py b/server/api/code/lacity_data_api/routers/councils.py index 362521c26..1e95b8d53 100644 --- a/server/api/code/lacity_data_api/routers/councils.py +++ b/server/api/code/lacity_data_api/routers/councils.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from ..models.schemas import CouncilList +from ..models.api_models import CouncilList, TypeCountList from ..models.council import Council, get_open_request_counts router = APIRouter() @@ -19,7 +19,7 @@ async def get_council(id: int): # TODO: add test -@router.get("/{id}/counts/open/types") +@router.get("/{id}/counts/open/types", response_model=TypeCountList) async def get_council_open_requests(id: int): result = await get_open_request_counts(id) return result diff --git a/server/api/code/lacity_data_api/routers/regions.py b/server/api/code/lacity_data_api/routers/regions.py index e498fd194..bd1799adb 100644 --- a/server/api/code/lacity_data_api/routers/regions.py +++ b/server/api/code/lacity_data_api/routers/regions.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from ..models.schemas import RegionList +from ..models.api_models import RegionList from ..models.region import Region router = APIRouter() diff --git a/server/api/code/lacity_data_api/routers/request_types.py b/server/api/code/lacity_data_api/routers/request_types.py index ddcf9e2ac..9e488fbe2 100644 --- a/server/api/code/lacity_data_api/routers/request_types.py +++ b/server/api/code/lacity_data_api/routers/request_types.py @@ -1,6 +1,6 @@ from fastapi import APIRouter -from ..models.schemas import RequestTypeList +from ..models.api_models import RequestTypeList from ..models.request_type import RequestType router = APIRouter() diff --git a/server/api/code/lacity_data_api/routers/service_requests.py b/server/api/code/lacity_data_api/routers/service_requests.py index e3eea292c..e53a4127a 100644 --- a/server/api/code/lacity_data_api/routers/service_requests.py +++ b/server/api/code/lacity_data_api/routers/service_requests.py @@ -1,8 +1,8 @@ from sqlalchemy import sql from fastapi import APIRouter -from ..models.schemas import ( - ServiceRequestList, Filters, PinList +from ..models.api_models import ( + ServiceRequestList, Filters, PinList, TypeCountList ) from ..models.service_request import ( ServiceRequest, get_open_request_counts, get_open_requests, get_filtered_requests @@ -23,7 +23,7 @@ async def get_all_service_requests(skip: int = 0, limit: int = 100): return result -@router.get("/counts/open/types") +@router.get("/counts/open/types", response_model=TypeCountList) async def get_open_request_counts_by_type(): result = await get_open_request_counts() return result diff --git a/server/api/code/lacity_data_api/routers/shim.py b/server/api/code/lacity_data_api/routers/shim.py index 6b8a0e74e..093143f67 100644 --- a/server/api/code/lacity_data_api/routers/shim.py +++ b/server/api/code/lacity_data_api/routers/shim.py @@ -1,6 +1,6 @@ from fastapi import APIRouter, status -from ..models.schemas import ( +from ..models.api_models import ( Filter, Feedback, Comparison ) from ..models import ( diff --git a/server/api/code/lacity_data_api/routers/status.py b/server/api/code/lacity_data_api/routers/status.py index 9a96ff979..af71d9c95 100644 --- a/server/api/code/lacity_data_api/routers/status.py +++ b/server/api/code/lacity_data_api/routers/status.py @@ -4,7 +4,7 @@ from fastapi import APIRouter -from ..models.schemas import StatusTypes +from ..models.api_models import StatusTypes from ..services import status, utilities from ..config import GITHUB_CODE_VERSION, GITHUB_SHA, DEBUG, STAGE