feat(phase-4b): backend business-logic, 8 entities, 32 endpoints, 58 tests

This commit is contained in:
CRM Bot
2026-06-03 21:40:26 +00:00
parent 955607f730
commit 53cbcde729
45 changed files with 3902 additions and 4 deletions
+22 -2
View File
@@ -23,7 +23,18 @@ from sqlalchemy.exc import SQLAlchemyError
from starlette.exceptions import HTTPException as StarletteHTTPException
from app import __version__
from app.api.v1 import auth, health, users
from app.api.v1 import (
accounts,
activities,
auth,
contacts,
dashboard,
deals,
health,
notes,
tags,
users,
)
from app.core.config import get_settings
from app.core.db import AsyncSessionLocal, dispose_engine
@@ -148,9 +159,10 @@ def create_app() -> FastAPI:
request: Request, exc: RequestValidationError
) -> JSONResponse:
"""Format Pydantic validation errors consistently."""
from fastapi.encoders import jsonable_encoder
return JSONResponse(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
content={"detail": exc.errors()},
content={"detail": jsonable_encoder(exc.errors())},
)
@app.exception_handler(SQLAlchemyError)
@@ -169,6 +181,14 @@ def create_app() -> FastAPI:
app.include_router(health.router)
app.include_router(auth.router, prefix="/api/v1")
app.include_router(users.router, prefix="/api/v1")
# Phase 4b business routers
app.include_router(accounts.router, prefix="/api/v1")
app.include_router(contacts.router, prefix="/api/v1")
app.include_router(deals.router, prefix="/api/v1")
app.include_router(activities.router, prefix="/api/v1")
app.include_router(notes.router, prefix="/api/v1")
app.include_router(tags.router, prefix="/api/v1")
app.include_router(dashboard.router, prefix="/api/v1")
return app