Ingredients as many-to-many relations + VS Code/Antigravity launch.json

- new ingredients collection (uid, name, emoji icon, diet_class) synced
  by update-menu.mjs; menu_items.ingredients is an M2M relation — the
  script maps data-file uids to fresh PB record ids
- diet select removed: the green/red FSSAI badge is derived (non-veg when
  any linked ingredient is non-veg); 164 items tagged (11 ingredients)
- menu cards render ingredient chips (icon + name) under the description
- migration 1788500200_menu_ingredients.js (idempotent create — app.save
  returns nil on success in the JSVM, so don't test its return value)
- .vscode/launch.json: PocketBase + Vite dev, build+preview, menu sync,
  full-stack compound (dev PB on :8091 — 8090 is taken on this host)
This commit is contained in:
2026-09-03 19:08:46 +05:30
parent e3444dbc60
commit d9ba227657
9 changed files with 435 additions and 192 deletions
+21 -2
View File
@@ -164,8 +164,9 @@ PB_SUPERUSER_PASSWORD=... \
node scripts/update-menu.mjs
```
The script **replaces** all `menu_categories` / `menu_items` records (deletes old, inserts
new) and touches nothing else.
The script **replaces** all `menu_categories` / `ingredients` / `menu_items` records (deletes
old, inserts new; item ingredient uids are mapped to the fresh ingredient record ids) and
touches nothing else.
### `menu_items` schema (POS-oriented)
@@ -176,6 +177,11 @@ new) and touches nothing else.
- `description`
- `price` — number, rupees with optional paise after the decimal point
(449 = ₹449, 449.5 = ₹449.50)
- `ingredients` — many-to-many relation to the `ingredients` collection (Nuts, Dairy,
Gluten, Soy, Mushroom, Egg, Chicken, Fish, Prawns, Pork, Mutton). Each ingredient has a
name, an emoji `icon` (rendered as chips on menu cards) and a `diet_class`
(`veg`/`nonveg`); an item's green/red FSSAI badge is **derived** — it shows non-veg when
any linked ingredient is non-veg
- `diet` — select: `veg` / `nonveg` / `mixed` (a bool can't be null in PocketBase, so mixed
items like Caesar Salad use `mixed`; the site renders no badge for it)
- `pairing` — optional beer pairing
@@ -188,6 +194,19 @@ new) and touches nothing else.
Admin edits to menu records are overwritten by the next sync — treat `menu-data.mjs` as the
menu's source of truth.
## Local development (IDE)
`.vscode/launch.json` has run configurations for VS Code / Antigravity:
- **GreatBear (full stack)** — compound: PocketBase (:8091) + Vite dev server (:3000)
- `PocketBase (dev, :8091)` — serves `./pb_data` with `./pb/migrations`
- `Site (Vite dev, :3000)` — the website against the local PocketBase
- `Site (production build + preview)` — builds `.output` and previews it
- `Sync menu into PocketBase` — runs `scripts/update-menu.mjs` against the local PB
Dev PocketBase runs on **8091** (8090 is occupied by another service on this machine).
First-time setup is in the comments at the top of `launch.json`.
## Container environment
| Variable | Default | Purpose |