44a448e26d
Frontend: - Split nodeTypes/edgeTypes into separate .ts files (react-refresh) - Remove setState-in-effect in NodeModal (key prop reset) - Fix handleSave accessed before declaration (useRef pattern) - Exclude src/components/ui/** from eslint (shadcn generated) - Use defineConfig from vitest/config for test type support Backend: - ruff --fix: sort imports, datetime.UTC alias - Raise line-length to 120, ignore E501 in tests - Break long update_node/update_edge signatures - pyproject.toml: per-file-ignores for tests
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.routes import auth, canvas, edges, nodes, scan, status
|
|
from app.core.config import settings
|
|
from app.db.database import init_db
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
await init_db()
|
|
yield
|
|
|
|
|
|
app = FastAPI(
|
|
title="Homelable API",
|
|
version="0.1.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router, prefix="/api/v1/auth", tags=["auth"])
|
|
app.include_router(nodes.router, prefix="/api/v1/nodes", tags=["nodes"])
|
|
app.include_router(edges.router, prefix="/api/v1/edges", tags=["edges"])
|
|
app.include_router(canvas.router, prefix="/api/v1/canvas", tags=["canvas"])
|
|
app.include_router(scan.router, prefix="/api/v1/scan", tags=["scan"])
|
|
app.include_router(status.router, prefix="/api/v1/status", tags=["status"])
|
|
|
|
|
|
@app.get("/api/v1/health")
|
|
async def health():
|
|
return {"status": "ok"}
|