REFACTOR ALL APIs

This commit is contained in:
Urtzi Alfaro
2025-10-06 15:27:01 +02:00
parent dc8221bd2f
commit 38fb98bc27
166 changed files with 18454 additions and 13605 deletions

View File

@@ -10,13 +10,21 @@ from sqlalchemy import text
# Import core modules
from app.core.config import settings
from app.core.database import database_manager
from app.api import ingredients, stock, classification, transformations
from app.services.inventory_alert_service import InventoryAlertService
from shared.service_base import StandardFastAPIService
# Import enhanced routers
from app.api.dashboard import router as dashboard_router
from app.api.food_safety import router as food_safety_router
from app.api import (
ingredients,
stock_entries,
transformations,
inventory_operations,
food_safety_compliance,
temperature_logs,
food_safety_alerts,
food_safety_operations,
dashboard,
analytics
)
class InventoryService(StandardFastAPIService):
@@ -57,7 +65,7 @@ class InventoryService(StandardFastAPIService):
version=settings.VERSION,
log_level=settings.LOG_LEVEL,
cors_origins=settings.CORS_ORIGINS,
api_prefix=settings.API_V1_STR,
api_prefix="", # Empty because RouteBuilder already includes /api/v1
database_manager=database_manager,
expected_tables=inventory_expected_tables
)
@@ -107,13 +115,17 @@ app = service.create_app()
# Setup standard endpoints
service.setup_standard_endpoints()
# Include routers using the service helper
# Include new standardized routers
service.add_router(ingredients.router)
service.add_router(stock.router)
service.add_router(stock_entries.router)
service.add_router(transformations.router)
service.add_router(classification.router)
service.add_router(dashboard_router)
service.add_router(food_safety_router)
service.add_router(inventory_operations.router)
service.add_router(food_safety_compliance.router)
service.add_router(temperature_logs.router)
service.add_router(food_safety_alerts.router)
service.add_router(food_safety_operations.router)
service.add_router(dashboard.router)
service.add_router(analytics.router)
if __name__ == "__main__":