
This API provides endpoints for: - Product and inventory management - Customer management - Order processing - Payment processing with Stripe integration - User authentication generated with BackendIM... (backend.im)
31 lines
697 B
Python
31 lines
697 B
Python
from typing import Any, Dict
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api import deps
|
|
from app.db.session import SessionLocal
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/health", response_model=Dict[str, Any])
|
|
def health_check(db: Session = Depends(deps.get_db)) -> Any:
|
|
"""
|
|
Check API health status
|
|
"""
|
|
# Check database connection
|
|
db_status = "healthy"
|
|
try:
|
|
# Execute a simple query
|
|
db.execute("SELECT 1")
|
|
except Exception as e:
|
|
db_status = f"unhealthy: {str(e)}"
|
|
|
|
return {
|
|
"status": "ok",
|
|
"components": {
|
|
"database": db_status
|
|
},
|
|
"version": "0.1.0"
|
|
} |