Initial kitchen scaffold — Phase 1 kitchen port (build-verified 2026-07-11)

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>
This commit is contained in:
jtricerolph 2026-07-12 12:15:39 +00:00
commit 8d688b459d
10003 changed files with 1928395 additions and 0 deletions

View file

@ -0,0 +1,45 @@
"""
Migration: Add 'required' to food_flag_categories, 'flags_assessed' to ingredients,
and 'ingredient_flag_nones' table for per-category "None apply" tracking.
"""
import asyncio
from sqlalchemy import text
from database import engine
async def migrate():
async with engine.begin() as conn:
# Add 'required' boolean to food_flag_categories (default false)
await conn.execute(text(
"ALTER TABLE food_flag_categories ADD COLUMN IF NOT EXISTS required BOOLEAN DEFAULT false"
))
# Auto-set 'contains' categories as required (allergens should be assessed)
await conn.execute(text(
"UPDATE food_flag_categories SET required = true WHERE propagation_type = 'contains'"
))
# Add 'flags_assessed' boolean to ingredients (kept for compat, not actively used)
await conn.execute(text(
"ALTER TABLE ingredients ADD COLUMN IF NOT EXISTS flags_assessed BOOLEAN DEFAULT false"
))
# Create ingredient_flag_nones table (per-category "None apply" tracking)
await conn.execute(text("""
CREATE TABLE IF NOT EXISTS ingredient_flag_nones (
id SERIAL PRIMARY KEY,
ingredient_id INTEGER NOT NULL REFERENCES ingredients(id) ON DELETE CASCADE,
category_id INTEGER NOT NULL REFERENCES food_flag_categories(id) ON DELETE CASCADE,
created_at TIMESTAMP DEFAULT NOW(),
CONSTRAINT uq_ingredient_flag_nones_ing_cat UNIQUE (ingredient_id, category_id)
)
"""))
await conn.execute(text(
"CREATE INDEX IF NOT EXISTS idx_ingredient_flag_nones_ing ON ingredient_flag_nones(ingredient_id)"
))
print("+ Added food_flag_categories.required, ingredient_flag_nones table")
if __name__ == "__main__":
asyncio.run(migrate())