QC check
This commit is contained in:
43
main.py
43
main.py
@@ -2,8 +2,8 @@ import logging
|
||||
from datetime import datetime
|
||||
|
||||
from fastapi import Depends, FastAPI, HTTPException
|
||||
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -49,25 +49,27 @@ def health_check(db: Session = Depends(get_db)):
|
||||
try:
|
||||
# Test database connection
|
||||
db.execute(text("SELECT 1"))
|
||||
return {"status": "healthy",
|
||||
"timestamp": datetime.utcnow(),
|
||||
"message": f"{settings.project_name} v{settings.version}",
|
||||
"docs": {
|
||||
"swagger": "/docs",
|
||||
"redoc": "/redoc",
|
||||
"openapi": "/openapi.json",
|
||||
"complete": "Documentation site URL here"
|
||||
},
|
||||
"features": [
|
||||
"JWT Authentication",
|
||||
"Marketplace-aware product import",
|
||||
"Multi-shop product management",
|
||||
"Stock management with location tracking",
|
||||
],
|
||||
"supported_marketplaces": [
|
||||
"Letzshop",
|
||||
],
|
||||
"auth_required": "Most endpoints require Bearer token authentication", }
|
||||
return {
|
||||
"status": "healthy",
|
||||
"timestamp": datetime.utcnow(),
|
||||
"message": f"{settings.project_name} v{settings.version}",
|
||||
"docs": {
|
||||
"swagger": "/docs",
|
||||
"redoc": "/redoc",
|
||||
"openapi": "/openapi.json",
|
||||
"complete": "Documentation site URL here",
|
||||
},
|
||||
"features": [
|
||||
"JWT Authentication",
|
||||
"Marketplace-aware product import",
|
||||
"Multi-shop product management",
|
||||
"Stock management with location tracking",
|
||||
],
|
||||
"supported_marketplaces": [
|
||||
"Letzshop",
|
||||
],
|
||||
"auth_required": "Most endpoints require Bearer token authentication",
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Health check failed: {e}")
|
||||
raise HTTPException(status_code=503, detail="Service unhealthy")
|
||||
@@ -161,6 +163,7 @@ async def documentation_page():
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
|
||||
Reference in New Issue
Block a user