fix: Resolve build errors and add database migrations

- Fix frontend import: Change from useAppContext to useTenant store
- Fix backend imports: Use app.core.database instead of shared.database
- Remove auth dependencies from dashboard endpoints
- Add database migrations for reasoning fields in procurement and production

Migrations:
- procurement: Add reasoning, consequence, reasoning_data to purchase_orders
- production: Add reasoning, reasoning_data to production_batches
This commit is contained in:
Claude
2025-11-07 17:19:46 +00:00
parent 2ced1ec670
commit 436622dc9a
4 changed files with 61 additions and 11 deletions

View File

@@ -13,9 +13,7 @@ from datetime import datetime
import logging
import httpx
from shared.database.session import get_db
from shared.auth.dependencies import require_user, get_current_user_id
from shared.auth.permissions import require_subscription_tier
from app.core.database import get_db
from ..services.dashboard_service import DashboardService
logger = logging.getLogger(__name__)
@@ -164,7 +162,6 @@ class InsightsResponse(BaseModel):
@router.get("/health-status", response_model=BakeryHealthStatusResponse)
async def get_bakery_health_status(
tenant_id: str,
user_id: str = Depends(get_current_user_id),
db: AsyncSession = Depends(get_db)
) -> BakeryHealthStatusResponse:
"""
@@ -251,7 +248,6 @@ async def get_bakery_health_status(
async def get_orchestration_summary(
tenant_id: str,
run_id: Optional[str] = Query(None, description="Specific run ID, or latest if not provided"),
user_id: str = Depends(get_current_user_id),
db: AsyncSession = Depends(get_db)
) -> OrchestrationSummaryResponse:
"""
@@ -319,7 +315,6 @@ async def get_orchestration_summary(
@router.get("/action-queue", response_model=ActionQueueResponse)
async def get_action_queue(
tenant_id: str,
user_id: str = Depends(get_current_user_id),
db: AsyncSession = Depends(get_db)
) -> ActionQueueResponse:
"""
@@ -399,7 +394,6 @@ async def get_action_queue(
@router.get("/production-timeline", response_model=ProductionTimelineResponse)
async def get_production_timeline(
tenant_id: str,
user_id: str = Depends(get_current_user_id),
db: AsyncSession = Depends(get_db)
) -> ProductionTimelineResponse:
"""
@@ -449,7 +443,6 @@ async def get_production_timeline(
@router.get("/insights", response_model=InsightsResponse)
async def get_insights(
tenant_id: str,
user_id: str = Depends(get_current_user_id),
db: AsyncSession = Depends(get_db)
) -> InsightsResponse:
"""