feat: add org catalog item flow for inventory#103
Conversation
- add org-mode inventory add flow with permission gating - handle duplicate org items with merge prompt and 409 recovery - wire backend org inventory duplicate detection and frontend permissions service
There was a problem hiding this comment.
Pull request overview
Adds an organization-mode “catalog add → org inventory” flow to the Inventory UI with permission gating, and introduces backend duplicate detection (409) for org inventory creates, plus several UX improvements to inline editing and filtering.
Changes:
- Frontend: org-mode UI state + permission-gated “Add org item” flow with 409 conflict handling and inline editor focus/UX updates.
- Backend: org inventory create now detects duplicates and returns 409; org inventory list endpoint query parsing updated; repository adds
findExistingItem. - Supporting refactors: memoized location filtering, inline row memoization, and filter panel disabling during refresh.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/services/permissions.service.ts | Adds frontend service + constants for fetching org permissions. |
| frontend/src/pages/Inventory.tsx | Implements org-mode add flow, permission gating, conflict handling, session persistence, and inline editor UX changes. |
| frontend/src/hooks/useMemoizedLocations.ts | Updates location filtering hook to return results only when active. |
| frontend/src/components/inventory/InventoryInlineRow.tsx | Refactors inline editor interactions (click-to-edit), adds memoization, and updates location selection behavior. |
| frontend/src/components/inventory/InventoryFiltersPanel.tsx | Adds disabled-state support and configurable add-button label. |
| backend/src/modules/org-inventory/org-inventory.service.ts | Adds pre-create duplicate detection and throws 409 Conflict. |
| backend/src/modules/org-inventory/org-inventory.service.spec.ts | Adds unit test coverage for the new 409 conflict behavior. |
| backend/src/modules/org-inventory/org-inventory.repository.ts | Adds findExistingItem helper and adjusts sort-column mapping. |
| backend/src/modules/org-inventory/org-inventory.controller.ts | Changes org inventory list query handling (manual parsing) and documents 409 response for create. |
Comments suppressed due to low confidence (1)
frontend/src/pages/Inventory.tsx:1758
renderInlineRowpassesinlineDraft={inlineDrafts[item.id] ?? { ... }}which creates a new object on every render for rows without an explicit draft. SinceInventoryInlineRowis now memoized with reference equality oninlineDraft, this defeats memoization and can cause unnecessary re-renders. Consider memoizing the fallback draft per-item (or compare draft fields instead of object identity inareEqual).
const rowKey = item.id.toString();
const draft = inlineDrafts[item.id] ?? {
locationId: Number(item.locationId) || '',
quantity: Number(item.quantity) || 0,
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Validation
Notes
Closes #55