Automated Action be0ae5f3b3 Implement small business inventory management system
- Create project structure with FastAPI and SQLAlchemy
- Implement database models for items, categories, suppliers, and stock movements
- Add CRUD operations for all models
- Configure Alembic for database migrations
- Create RESTful API endpoints for inventory management
- Add health endpoint for system monitoring
- Update README with setup and usage instructions

generated with BackendIM... (backend.im)
2025-05-12 16:23:23 +00:00

17 lines
499 B
Python

from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.database import get_db
router = APIRouter(
prefix="/health",
tags=["Health"]
)
@router.get("/")
async def health_check(db: Session = Depends(get_db)):
try:
# Check if database is accessible
db.execute("SELECT 1")
return {"status": "healthy", "database": "connected"}
except Exception as e:
return {"status": "unhealthy", "database": "disconnected", "error": str(e)}