6c86f0f571
- integrated request-module into module registry - moved backend into modules/request-module - added manifest.json and module.py - implemented dynamic router mounting - implemented dynamic static mounting - removed direct dependencies from platform core - verified startup with request-module - verified startup without request-module - added implementation_report_003.md
37 lines
896 B
Python
37 lines
896 B
Python
"""Health check routes."""
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
from sqlalchemy import text
|
|
from request_app.core.database import get_db
|
|
|
|
router = APIRouter(tags=["Health"])
|
|
|
|
|
|
@router.get("/health")
|
|
async def health_check():
|
|
"""Health check endpoint."""
|
|
return {
|
|
"status": "healthy",
|
|
"service": "Service Request System",
|
|
"version": "1.0.0"
|
|
}
|
|
|
|
|
|
@router.get("/health/db")
|
|
async def health_check_db(db: Session = Depends(get_db)):
|
|
"""Check database connectivity."""
|
|
try:
|
|
db.execute(text("SELECT 1"))
|
|
return {
|
|
"status": "healthy",
|
|
"database": "PostgreSQL",
|
|
"message": "Database connection successful"
|
|
}
|
|
except Exception as e:
|
|
return {
|
|
"status": "unhealthy",
|
|
"database": "PostgreSQL",
|
|
"error": str(e)
|
|
}
|