47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
from fastapi import APIRouter
|
|
from datetime import datetime
|
|
from models.schemas import RootResponse, HealthResponse, ServiceStatus
|
|
from services.config import SERVICES
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/",
|
|
response_model=RootResponse,
|
|
summary="API Root",
|
|
description="Get basic API information",
|
|
tags=["General"])
|
|
async def root():
|
|
"""Get basic API information and version"""
|
|
return RootResponse(
|
|
message="LabFusion Service Adapters API",
|
|
version="1.0.0"
|
|
)
|
|
|
|
@router.get("/health",
|
|
response_model=HealthResponse,
|
|
summary="Health Check",
|
|
description="Check service health status",
|
|
tags=["General"])
|
|
async def health_check():
|
|
"""Check the health status of the service adapters"""
|
|
return HealthResponse(
|
|
status="healthy",
|
|
timestamp=datetime.now().isoformat()
|
|
)
|
|
|
|
@router.get("/services",
|
|
response_model=dict,
|
|
summary="Get Service Status",
|
|
description="Get status of all configured external services",
|
|
tags=["Services"])
|
|
async def get_services():
|
|
"""Get status of all configured external services (Home Assistant, Frigate, Immich, n8n)"""
|
|
service_status = {}
|
|
for service_name, config in SERVICES.items():
|
|
service_status[service_name] = ServiceStatus(
|
|
enabled=config["enabled"],
|
|
url=config["url"],
|
|
status="unknown" # Would check actual service status
|
|
)
|
|
return service_status
|