Skip to content

feat: add org catalog item flow for inventory#103

Open
GitAddRemote wants to merge 6 commits intomainfrom
feature/ISSUE-55-clean
Open

feat: add org catalog item flow for inventory#103
GitAddRemote wants to merge 6 commits intomainfrom
feature/ISSUE-55-clean

Conversation

@GitAddRemote
Copy link
Copy Markdown
Owner

Summary

  • add the org inventory catalog add flow in the inventory UI with org-mode permission gating
  • handle duplicate org item conflicts with backend 409 detection and frontend merge/update recovery
  • include the supporting inventory filter and inline-row updates used by this cleaned issue 55 branch

Validation

  • pnpm --filter frontend typecheck
  • pnpm --filter backend test -- org-inventory.service.spec.ts

Notes

  • this PR is the cleaned issue 55 branch and intentionally excludes the out-of-scope UEX orbit/location sync work that had been mixed into the older branch

Closes #55

- 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • renderInlineRow passes inlineDraft={inlineDrafts[item.id] ?? { ... }} which creates a new object on every render for rows without an explicit draft. Since InventoryInlineRow is now memoized with reference equality on inlineDraft, this defeats memoization and can cause unnecessary re-renders. Consider memoizing the fallback draft per-item (or compare draft fields instead of object identity in areEqual).
    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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User Story: Add catalog items to organization inventory

2 participants