Spaces:
Runtime error
Runtime error
| from aiohttp.web import json_response, Request, Response | |
| from pydantic import ConfigDict | |
| from typing import Self | |
| from .base import ControllerBase, controller, get | |
| from ctp_slack_bot.services import ApplicationHealthService | |
| class ApplicationHealthController(ControllerBase): | |
| """ | |
| Application health reporting endpoints. | |
| """ | |
| model_config = ConfigDict(frozen=True) | |
| application_health_service: ApplicationHealthService | |
| async def get_health(self: Self, request: Request) -> Response: | |
| health_statuses = await self.application_health_service.get_health() | |
| return json_response(dict(health_statuses), status=200 if all(health_statuses.values()) else 503) | |
| def name(self: Self) -> str: | |
| return "application_health_controller" | |