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

@@ -0,0 +1,27 @@
"""add reasoning fields to production batches
Revision ID: 20251107_add_reasoning_fields
Revises: 20251023_0900_add_waste_tracking_fields
Create Date: 2025-11-07
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '20251107_add_reasoning_fields'
down_revision = '20251023_0900_add_waste_tracking_fields'
branch_labels = None
depends_on = None
def upgrade():
# Add reasoning fields to production_batches table
op.add_column('production_batches', sa.Column('reasoning', sa.Text(), nullable=True))
op.add_column('production_batches', sa.Column('reasoning_data', sa.JSON(), nullable=True))
def downgrade():
# Remove reasoning fields from production_batches table
op.drop_column('production_batches', 'reasoning_data')
op.drop_column('production_batches', 'reasoning')