v1.3 - client and admin scaffolding
This commit is contained in:
+9
-2
@@ -11,6 +11,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
||||
import uvicorn
|
||||
|
||||
from app.api.auth import router as auth_router
|
||||
from app.api.client_access import router as client_access_router
|
||||
from app.api.mixes import router as mixes_router
|
||||
from app.api.powerbi import router as powerbi_router
|
||||
from app.api.products import router as products_router
|
||||
@@ -18,13 +19,16 @@ from app.api.raw_materials import router as raw_materials_router
|
||||
from app.api.scenarios import router as scenarios_router
|
||||
from app.core.config import settings
|
||||
from app.db.session import Base, engine
|
||||
from app.db.migrations import ensure_tenant_columns, sync_tenant_ids
|
||||
from app.seed import seed_if_empty
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(_: FastAPI):
|
||||
Base.metadata.create_all(bind=engine)
|
||||
ensure_tenant_columns(engine)
|
||||
seed_if_empty()
|
||||
sync_tenant_ids(engine)
|
||||
yield
|
||||
|
||||
|
||||
@@ -32,13 +36,14 @@ app = FastAPI(title=settings.app_name, lifespan=lifespan)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_origins=["http://localhost:5173", "http://localhost:5174"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.include_router(auth_router)
|
||||
app.include_router(client_access_router)
|
||||
app.include_router(raw_materials_router)
|
||||
app.include_router(mixes_router)
|
||||
app.include_router(products_router)
|
||||
@@ -58,11 +63,13 @@ def root():
|
||||
"Confirm finished product pricing outputs",
|
||||
],
|
||||
"endpoints": {
|
||||
"login": "/api/auth/login",
|
||||
"client_login": "/api/auth/client/login",
|
||||
"admin_login": "/api/auth/admin/login",
|
||||
"raw_materials": "/api/raw-materials",
|
||||
"mixes": "/api/mixes",
|
||||
"products": "/api/products",
|
||||
"scenarios": "/api/scenarios",
|
||||
"client_access": "/api/client-access",
|
||||
"docs": "/docs",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user