FastAPI backend (Python 3.11, MSSQL ODBC for SambaPOS, Azure DI OCR),
kitchen_db on central PG. React/TS/Vite frontend with navy sidebar layout.
Backend: auth.py (APP_SLUG=kitchen, SimpleNamespace — archive routes use
.kitchen_id/.is_admin without modification), main.py (51 migrations, scheduler,
internal router for KDS bookings feed), api/internal.py, full archive API
(31 routers: invoices, recipes, menus, sambapos, resos, newbook, disputes,
purchase_orders, etc.), models, migrations, OCR pipeline.
kitchen_id pinned to 1 (B1 — single hotel).
Frontend: AuthGate (app=kitchen, token shim for archive compat — B5b pending),
Layout (navy sidebar, 6 sections, Lucide icons, teal --app-primary),
App.tsx (Outlet pattern, UploadApp outside Layout), index.css (full :root block).
strict: false — archive components have type issues; build clean.
Note: 45 archive components call fetch('/api/...') without /kitchen/ prefix
(B5b). Runtime 404s; deferred until after initial testing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""
|
|
Migration: Add ingredient_flag_dismissals table for tracking dismissed allergen suggestions.
|
|
"""
|
|
import asyncio
|
|
from sqlalchemy import text
|
|
from database import engine
|
|
|
|
|
|
async def migrate():
|
|
async with engine.begin() as conn:
|
|
await conn.execute(text("""
|
|
CREATE TABLE IF NOT EXISTS ingredient_flag_dismissals (
|
|
id SERIAL PRIMARY KEY,
|
|
ingredient_id INTEGER NOT NULL REFERENCES ingredients(id) ON DELETE CASCADE,
|
|
food_flag_id INTEGER NOT NULL REFERENCES food_flags(id) ON DELETE CASCADE,
|
|
dismissed_by_name VARCHAR(100) NOT NULL,
|
|
reason TEXT,
|
|
matched_keyword VARCHAR(200),
|
|
created_at TIMESTAMP DEFAULT NOW(),
|
|
CONSTRAINT uq_ingredient_flag_dismissals_ing_flag UNIQUE (ingredient_id, food_flag_id)
|
|
)
|
|
"""))
|
|
await conn.execute(text(
|
|
"CREATE INDEX IF NOT EXISTS idx_ingredient_flag_dismissals_ing ON ingredient_flag_dismissals(ingredient_id)"
|
|
))
|
|
print("+ Created ingredient_flag_dismissals table")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("Running migration: add_ingredient_flag_dismissals")
|
|
asyncio.run(migrate())
|
|
print("Migration complete!")
|