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,44 @@
"""
Migration script to add line item search capabilities:
- Enable pg_trgm extension for fuzzy text matching
- Create GIN index on line_items.description for trigram similarity
Run this script once after deploying the new code.
"""
import asyncio
import logging
from sqlalchemy import text
from database import engine
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
async def run_migration():
"""Add pg_trgm extension and trigram index for line item search."""
logger.info("Running line item search migration...")
# Enable pg_trgm extension for fuzzy text matching
try:
async with engine.begin() as conn:
await conn.execute(text("CREATE EXTENSION IF NOT EXISTS pg_trgm"))
logger.info("Enabled pg_trgm extension")
except Exception as e:
logger.warning(f"pg_trgm extension: {e}")
# Create GIN index for trigram similarity on description
try:
async with engine.begin() as conn:
await conn.execute(text(
"CREATE INDEX IF NOT EXISTS ix_line_items_description_trgm "
"ON line_items USING gin (description gin_trgm_ops)"
))
logger.info("Created trigram index on line_items.description")
except Exception as e:
logger.warning(f"Trigram index: {e}")
logger.info("Line item search migration completed!")
if __name__ == "__main__":
asyncio.run(run_migration())