Company-search saves: starred + recent companies

↗ view on GitHub · sloth-ninja · 2026-07-28 · b7e83974

Application code for the starred/recent companies feature over the
company_search_saves table (migration #49).

Backend: self-contained lib/companySearchSaves.ts (recordCompanyView with
snapshot refresh + 25-recent prune that never prunes starred rows;
setCompanyStar that inserts a not-yet-saved company from its snapshot;
listCompanySaves), all 42P01/42703-tolerant so an unmigrated production DB
degrades to empty lists / no-ops. Routes on the existing /companies router
(same requireAuth + research limiter, sibling try/catch + fixed generic
detail, caller id from the session): GET /companies/saves,
POST /companies/:companyNumber/view, PUT /companies/:companyNumber/star, with
exported validateViewBody / validateStarBody body validation.

Frontend: company-search rail shows Starred then Recent sections (star toggle
per row) when the search box is empty, a header star toggle for the open
company, best-effort fire-and-forget view recording on open, and optimistic
star updates with rollback. mikeApi getCompanySaves/recordCompanyView/
setCompanyStar + types.

Tests: +20 backend (upsert/snapshot/prune, star/unstar incl. insert-with-
snapshot, cross-user isolation, 42P01/42703 degradation, route validation).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Parents 9d2b0f1c
Stats 7 files changed , +2630 , -1435
Part of WS7: Company Search panel + saves/status trains

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-b7e83974.md from inside the repo you want the change in.

⬇ Download capture-commit-b7e83974.md