Add manufacturer catalog, category/manufacturer library management, and built-in cable flag

Normalizes manufacturer as a shared catalog entity (like device categories)
instead of free text on each device, giving the admin duplicate-detection
nudge a reliable signal. Adds full CRUD (including Admin direct-publish,
bypassing the submission queue) for categories, manufacturers, port types,
and cable types, plus a Categories & Manufacturers library modal and a
browse-by-manufacturer/search view in the device palette. Adds
Port.builtInCable so a captive/permanently-attached cable (a keyboard's USB
lead, a budget AVR's power cord) can be flagged and excluded from the BOM.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017DUU6CnxECCDeqDNYJgr5x
This commit is contained in:
2026-09-28 10:04:05 -05:00
co-authored by Claude Sonnet 5
parent 00777077c2
commit 29c3ed46a3
28 changed files with 2201 additions and 320 deletions
@@ -0,0 +1,30 @@
-- Wires up the normalized `manufacturers` catalog (organized-ideas.md §3:
-- "manufacturer becomes a normalized, submittable catalog — the same
-- public/user-defined pattern already used for device categories").
--
-- The table itself, its RLS policies, and device_templates.manufacturer_id
-- have all existed unused since the initial schema / the manufacturer_text
-- migration — this is the pass that actually populates and reads them.
-- Scope matches what device_category has today: create-your-own-private-one
-- only, no submission/admin-edit UI yet (that's a separate, already-tracked
-- follow-up for both entities together).
--
-- Any existing free-text manufacturer values (there's realistically at most
-- a handful of dev-only rows at this point, nothing shipped) get backfilled
-- into a manufacturers row each, grouped by (name, owner, is_public) so two
-- different users' private "Fake" manufacturers don't collide into one row.
insert into public.manufacturers (name, is_public, owner_id)
select distinct dt.manufacturer, dt.is_public, dt.owner_id
from public.device_templates dt
where dt.manufacturer is not null;
update public.device_templates dt
set manufacturer_id = m.id
from public.manufacturers m
where dt.manufacturer is not null
and m.name = dt.manufacturer
and m.is_public = dt.is_public
and m.owner_id is not distinct from dt.owner_id;
alter table public.device_templates drop column manufacturer;