updates
This commit is contained in:
@@ -42,15 +42,17 @@ if settings.is_development:
|
||||
logger.info("Creating database tables (development mode)")
|
||||
Base.metadata.create_all(bind=engine)
|
||||
else:
|
||||
# Ensure new cookie-related tables exist even if full migrations haven't been run yet.
|
||||
# Ensure new tables exist even if full migrations haven't been run yet.
|
||||
try:
|
||||
from .models.cookie_policy import CookiePolicy
|
||||
from .models.cookie_integration_config import CookieIntegrationConfig
|
||||
logger.info("Ensuring cookie-related tables exist")
|
||||
from .models.page_content import PageContent
|
||||
logger.info("Ensuring required tables exist")
|
||||
CookiePolicy.__table__.create(bind=engine, checkfirst=True)
|
||||
CookieIntegrationConfig.__table__.create(bind=engine, checkfirst=True)
|
||||
PageContent.__table__.create(bind=engine, checkfirst=True)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to ensure cookie tables exist: {e}")
|
||||
logger.error(f"Failed to ensure required tables exist: {e}")
|
||||
|
||||
from .routes import auth_routes
|
||||
from .routes import privacy_routes
|
||||
@@ -125,9 +127,11 @@ app.add_exception_handler(Exception, general_exception_handler)
|
||||
|
||||
# Enhanced Health check with database connectivity
|
||||
@app.get("/health", tags=["health"])
|
||||
@app.get("/api/health", tags=["health"])
|
||||
async def health_check(db: Session = Depends(get_db)):
|
||||
"""
|
||||
Enhanced health check endpoint with database connectivity test
|
||||
Available at both /health and /api/health for consistency
|
||||
"""
|
||||
health_status = {
|
||||
"status": "healthy",
|
||||
@@ -196,7 +200,7 @@ from .routes import (
|
||||
room_routes, booking_routes, payment_routes, invoice_routes, banner_routes,
|
||||
favorite_routes, service_routes, service_booking_routes, promotion_routes, report_routes,
|
||||
review_routes, user_routes, audit_routes, admin_privacy_routes,
|
||||
system_settings_routes, contact_routes
|
||||
system_settings_routes, contact_routes, page_content_routes
|
||||
)
|
||||
|
||||
# Legacy routes (maintain backward compatibility)
|
||||
@@ -234,6 +238,8 @@ app.include_router(audit_routes.router, prefix=settings.API_V1_PREFIX)
|
||||
app.include_router(admin_privacy_routes.router, prefix=settings.API_V1_PREFIX)
|
||||
app.include_router(system_settings_routes.router, prefix=settings.API_V1_PREFIX)
|
||||
app.include_router(contact_routes.router, prefix=settings.API_V1_PREFIX)
|
||||
app.include_router(page_content_routes.router, prefix="/api")
|
||||
app.include_router(page_content_routes.router, prefix=settings.API_V1_PREFIX)
|
||||
|
||||
logger.info("All routes registered successfully")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user