fix: Backend added along with missing pages
Some checks failed
Velocity-OS Deployment Pipeline / lint (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (agents) (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (core) (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (media-engine) (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (webos) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (agents) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (core) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (media-engine) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (webos) (push) Has been cancelled
Velocity-OS Deployment Pipeline / notify-ingress (push) Has been cancelled
Some checks failed
Velocity-OS Deployment Pipeline / lint (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (agents) (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (core) (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (media-engine) (push) Has been cancelled
Velocity-OS Deployment Pipeline / build-and-push (webos) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (agents) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (core) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (media-engine) (push) Has been cancelled
Velocity-OS Deployment Pipeline / sign-images (webos) (push) Has been cancelled
Velocity-OS Deployment Pipeline / notify-ingress (push) Has been cancelled
This commit is contained in:
17
core/main.py
17
core/main.py
@@ -56,6 +56,7 @@ _load_velocity_env()
|
||||
|
||||
from backend.api.routes_catalyst import router as catalyst_router
|
||||
from backend.api.routes_crm import crm_router, analytics_router
|
||||
from backend.api.routes_dashboard import router as dashboard_router
|
||||
from backend.api.routes_oracle import router as oracle_helper_router
|
||||
from backend.api.routes_mobile_edge import router as mobile_edge_router
|
||||
from backend.api.routes_inventory import router as inventory_router
|
||||
@@ -67,6 +68,8 @@ from backend.api.routes_comms import router as comms_router
|
||||
from backend.api.routes_runtime_llm import router as runtime_llm_router
|
||||
from backend.auth.routes import router as auth_router
|
||||
from backend.auth.user_directory import ensure_user_directory_schema
|
||||
from backend.crm.canonical_schema import ensure_canonical_crm_schema
|
||||
from backend.db.seed_synthetic_crm import seed as seed_synthetic_crm
|
||||
from backend.db.pool import create_pool, close_pool
|
||||
from backend.migrations.runner import apply_migrations
|
||||
from backend.observability import RequestObservabilityMiddleware
|
||||
@@ -92,7 +95,20 @@ async def lifespan(app: FastAPI):
|
||||
applied = await apply_migrations(conn)
|
||||
if applied:
|
||||
logger.info("Applied backend migrations: %s", ", ".join(applied))
|
||||
has_crm_schema = await conn.fetchval("SELECT to_regclass('public.crm_people') IS NOT NULL")
|
||||
if not has_crm_schema:
|
||||
schema_path = Path(__file__).resolve().parent / "db" / "db" / "schema_crm_canonical.sql"
|
||||
logger.info("Canonical CRM schema missing; applying %s", schema_path)
|
||||
await conn.execute(schema_path.read_text(encoding="utf-8"))
|
||||
await ensure_user_directory_schema(app)
|
||||
await ensure_canonical_crm_schema(app)
|
||||
if os.getenv("VELOCITY_AUTO_SEED_SYNTHETIC_CRM", "1").strip().lower() not in {"0", "false", "no"}:
|
||||
async with app.state.db_pool.acquire() as conn:
|
||||
people_count = await conn.fetchval("SELECT COUNT(*) FROM crm_people")
|
||||
if int(people_count or 0) == 0:
|
||||
logger.info("CRM is empty; seeding bundled synthetic CRM v2 data")
|
||||
counts = await seed_synthetic_crm(pool=app.state.db_pool)
|
||||
logger.info("Synthetic CRM v2 seed complete: %s", counts)
|
||||
except Exception as exc:
|
||||
logger.error("Failed to create DB pool: %s", exc)
|
||||
app.state.db_pool = None
|
||||
@@ -136,6 +152,7 @@ if os.path.isdir(ASSET_DIR):
|
||||
# ── Routers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
app.include_router(catalyst_router, prefix="/api/catalyst", tags=["Catalyst"])
|
||||
app.include_router(dashboard_router, prefix="/api", tags=["Dashboard"])
|
||||
app.include_router(crm_router, prefix="/api", tags=["CRM"])
|
||||
app.include_router(analytics_router, prefix="/api/analytics", tags=["Analytics"])
|
||||
app.include_router(oracle_helper_router, prefix="/api/oracle", tags=["Oracle"])
|
||||
|
||||
Reference in New Issue
Block a user