From e62b9601a2daffc7d018c0e77709bedfa10960d5 Mon Sep 17 00:00:00 2001 From: Shane Maynard Date: Sun, 9 Aug 2026 08:08:32 -0400 Subject: [PATCH] Add Equipment page: owned brewers and grinders filter the Brews UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - user_gear table (migration 008) + GET/PUT /api/gear (brewer keys validated against the taxonomy, grinders deduped/trimmed) - /gear page: silhouette multi-select for owned brewers (autosaves) and a grinder list; nav gains Brewing → Equipment - Brews page: with gear configured, the picker shows only owned brewers (plus the edited brew's method) with a show-all toggle; grinder field suggests your grinders; empty-gear state links to /gear - Included in full backups, per-user export, and the OpenAPI spec Co-Authored-By: Claude Fable 5 --- db/migrations/008_user_gear.sql | 8 ++ public/brews.html | 8 +- public/gear.html | 102 +++++++++++++++++++++ public/js/brews.js | 55 +++++++++++- public/js/gear.js | 154 ++++++++++++++++++++++++++++++++ public/js/nav.js | 1 + server/app.js | 56 ++++++++++++ server/openapi.js | 4 + test/brewing.test.js | 46 ++++++++++ test/helpers.js | 3 +- 10 files changed, 433 insertions(+), 4 deletions(-) create mode 100644 db/migrations/008_user_gear.sql create mode 100644 public/gear.html create mode 100644 public/js/gear.js diff --git a/db/migrations/008_user_gear.sql b/db/migrations/008_user_gear.sql new file mode 100644 index 0000000..0db7512 --- /dev/null +++ b/db/migrations/008_user_gear.sql @@ -0,0 +1,8 @@ +-- Additive only. Per-user owned equipment: which brewers the Brews page should offer +-- (subset of the shared brew-method keys) and the user's grinders (free-text names). +CREATE TABLE user_gear ( + user_id uuid PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE, + brewers jsonb NOT NULL DEFAULT '[]', + grinders jsonb NOT NULL DEFAULT '[]', + updated_at timestamptz NOT NULL DEFAULT now() +); diff --git a/public/brews.html b/public/brews.html index 319f829..fc2e9b3 100644 --- a/public/brews.html +++ b/public/brews.html @@ -107,8 +107,12 @@ > + >