Repository navigation
feat: owner-facing analytics dashboard (revenue, low-stock, trust score) - #16
Merged
Merged
Conversation
Adds GET /dashboard, restricted to owner/manager via authContext's new canViewDashboard(). Reads existing data only — inventory_records via its ShopConflictIndex GSI and orders via its existing pk/sk query — so there are zero schema changes and no new audit_log GSI, keeping the write-path untouched. - revenue: total, order count, average order value, trailing 7-day window - low_stock: items at/under a configurable threshold (default 5), sorted ascending - trust_score: (total_items - items_with_open_conflict) / total_items, derived from inventory_records' current conflict_status Frontend gets a role-gated Dashboard nav link and DashboardPage showing the same breakdown, color-toned by trust-score severity. Tests: 6 new API tests (dashboardQuery.test.ts), 3 new web tests (DashboardPage.test.tsx), 2 new App.test.tsx nav-visibility tests, 2 new CDK tests for the Analytics construct — full CDK suite (34/34) verified green including the new tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds GET /dashboard, restricted to owner/manager via authContext's new canViewDashboard(). Reads existing data only — inventory_records via its ShopConflictIndex GSI and orders via its existing pk/sk query — so there are zero schema changes and no new audit_log GSI, keeping the write-path untouched.
Frontend gets a role-gated Dashboard nav link and DashboardPage showing the same breakdown, color-toned by trust-score severity.
Tests: 6 new API tests (dashboardQuery.test.ts), 3 new web tests (DashboardPage.test.tsx), 2 new App.test.tsx nav-visibility tests, 2 new CDK tests for the Analytics construct — full CDK suite (34/34) verified green including the new tests.