diff --git a/.planning/phases/37-admin-global-item-management/37-01-SUMMARY.md b/.planning/phases/37-admin-global-item-management/37-01-SUMMARY.md new file mode 100644 index 0000000..18c83c6 --- /dev/null +++ b/.planning/phases/37-admin-global-item-management/37-01-SUMMARY.md @@ -0,0 +1,42 @@ +--- +plan: "37-01" +phase: 37 +status: complete +completed: "2026-04-19" +--- + +# Summary: 37-01 — Server — Admin Global Item Services & Routes + +## What Was Built + +Three new service functions added to `global-item.service.ts`, a new admin-items route file with four endpoints, and the router mounted in `admin.ts`. All protected by existing `requireAuth + requireAdmin` middleware. + +## Key Files + +### Created +- `src/server/routes/admin-items.ts` — Hono router with GET /, GET /:id, PUT /:id, DELETE /:id + +### Modified +- `src/server/services/global-item.service.ts` — Added `listGlobalItemsForAdmin`, `updateGlobalItemById`, `deleteGlobalItem` +- `src/server/routes/admin.ts` — Import and mount `adminItemRoutes` at `/items` +- `tests/services/global-item.service.test.ts` — 13 new tests across 3 describe blocks + +## Decisions & Deviations + +No deviations from the plan. All service functions implemented exactly as specified. + +## Test Results + +- `bun test tests/services/global-item.service.test.ts`: 32 pass, 0 fail +- `bun run build`: exits 0 + +## Self-Check: PASSED + +- [x] `listGlobalItemsForAdmin` — paginated with batched tag/ownerCount queries +- [x] `updateGlobalItemById` — partial update in transaction, syncs tags when provided +- [x] `deleteGlobalItem` — nullifies FK refs, removes tag associations before delete, returns false for missing items +- [x] `src/server/routes/admin-items.ts` created with all 4 endpoints +- [x] Router mounted at `/items` in admin.ts +- [x] All 13 new service tests pass +- [x] Build exits 0 +- [x] ADMN-02, ADMN-03, ADMN-04 served (server side) diff --git a/.planning/phases/37-admin-global-item-management/37-02-SUMMARY.md b/.planning/phases/37-admin-global-item-management/37-02-SUMMARY.md new file mode 100644 index 0000000..2184063 --- /dev/null +++ b/.planning/phases/37-admin-global-item-management/37-02-SUMMARY.md @@ -0,0 +1,45 @@ +--- +plan: "37-02" +phase: 37 +status: complete +completed: "2026-04-19" +--- + +# Summary: 37-02 — Client — Admin Items List, Edit Page & Sidebar + +## What Was Built + +Full client-side implementation of the admin global item management feature: hooks file, list page with infinite scroll, edit page with all fields and delete confirmation, and sidebar activation. + +## Key Files + +### Created +- `src/client/hooks/useAdminGlobalItems.ts` — `useAdminGlobalItems` (infinite query), `useAdminGlobalItem` (detail), `useUpdateAdminGlobalItem`, `useDeleteAdminGlobalItem` +- `src/client/routes/admin/items.tsx` — List page with data table, infinite scroll, search, tag filters, skeleton loading, empty state +- `src/client/routes/admin/items.$itemId.tsx` — Edit page with all fields, manufacturer dropdown, TagInput chip component, delete confirmation dialog with ownerCount + +### Modified +- `src/client/routes/admin.tsx` — Replaced disabled Items div with active `` +- `src/client/routeTree.gen.ts` — Auto-regenerated with `/admin/items` and `/admin/items/$itemId` routes + +## Decisions & Deviations + +- `useTags` hook existed and was used as-is for tag filter chips on list page +- `useFormatters()` returns `{ weight, price }` — used as `formatWeight`/`formatPrice` aliases in the list page + +## Test Results + +- `bun run build`: exits 0 +- routeTree.gen.ts contains both new admin routes confirmed + +## Self-Check: PASSED + +- [x] `useAdminGlobalItems.ts` with infinite query, detail, update/delete mutations +- [x] Sidebar Items link active (Link component, no "Soon" badge, no cursor-not-allowed) +- [x] List page with table, infinite scroll, search, tag filters, skeleton, empty state +- [x] Edit page with all fields, manufacturer dropdown, TagInput, save/delete actions +- [x] Delete confirmation shows ownerCount impact message +- [x] Navigate to `/admin/items` after successful delete +- [x] routeTree.gen.ts updated with both routes +- [x] Build exits 0 +- [x] ADMN-02, ADMN-03, ADMN-04 fully implemented (client side)