feat: T03+T04 backend - FastAPI, DB models, Rentman integration, admin auth, APScheduler

This commit is contained in:
Implementation Engineer
2026-07-09 01:36:46 +02:00
parent 3bfa54b4b3
commit 88cff68f73
78 changed files with 2174 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
"""Health check router."""
from fastapi import APIRouter, Depends
from sqlalchemy import text
from sqlalchemy.ext.asyncio import AsyncSession
from app.database import get_db, engine
from app.cache import cache
router = APIRouter(prefix="/api/health", tags=["health"])
@router.get("")
async def health_check(db: AsyncSession = Depends(get_db)) -> dict:
"""Return health status: app, db, redis."""
db_ok = "connected"
redis_ok = "connected"
try:
await db.execute(text("SELECT 1"))
except Exception:
db_ok = "disconnected"
try:
await cache.connect()
await cache._redis.ping()
except Exception:
redis_ok = "disconnected"
return {"status": "ok", "db": db_ok, "redis": redis_ok}