diff --git a/backend/src/api/routes/health.py b/backend/src/api/routes/health.py index fd5d591..6adb7e1 100644 --- a/backend/src/api/routes/health.py +++ b/backend/src/api/routes/health.py @@ -14,6 +14,7 @@ # limitations under the License. import fastapi +from src.models.schemas.health import HealthCheckResponse router = fastapi.APIRouter(prefix="/health", tags=["health"]) @@ -21,7 +22,7 @@ @router.get("", name="health:health-check") -async def health_check() -> dict: +async def health_check() -> HealthCheckResponse: """ Check the health of the service @@ -32,4 +33,4 @@ async def health_check() -> dict: Return: - **status**: The status of the service """ - return {"status": "ok"} \ No newline at end of file + return HealthCheckResponse(status="ok") \ No newline at end of file diff --git a/backend/src/models/schemas/health.py b/backend/src/models/schemas/health.py new file mode 100644 index 0000000..56c43cc --- /dev/null +++ b/backend/src/models/schemas/health.py @@ -0,0 +1,25 @@ +# coding=utf-8 + +# Copyright [2024] [SkywardAI] +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from src.models.schemas.base import BaseSchemaModel +from pydantic import Field + +class HealthCheckResponse(BaseSchemaModel): + """ + The status of the service + + - **status**: The status of the service + """ + status: str = Field(..., title="status", description="The status of the service", examples=['ok'])