Repository navigation
Conversation
When the confirmation team opens an order, they now see how the same customer's other orders ended: total, delivered, returned and cancelled, with a badge (new / pending / reliable / frequent returns). - cod-shared: getOrderById batches one grouped count over the customer's other orders (customers are unique per phone, rides idx_orders_customer; no schema change, no migration) - cod-server: CustomerHistory added to the Order OpenAPI schema - cod-client-astro: CustomerHistoryBadge in the customer card, AR/FR/EN strings, pure customerHistoryTone() in the orders model - Cancellations are shown but never colour the badge (they may be the merchant's own call); only carrier outcomes judge the customer - Tests: real-D1 E2E for the counts + unit tests for the summarizer and tone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D74yU9itwyFXKSvjwYfVGC
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
What does this PR do?
Adds a customer delivery history badge to the order detail page (customer card). When the confirmation team opens an order, they see how the same customer's other orders ended, so repeat door-refusers (and loyal buyers) are visible before calling or dispatching.
Previous orders: 5 · delivered: 4 · returned: 1 · cancelled: 0Badge rule: only carrier outcomes judge the customer. Cancellations are shown but never colour the badge, since a cancellation may be the merchant's own decision.
Implementation:
getOrderByIdbatches one extra groupedCOUNT(*)over the customer's other orders. Customers are unique per phone (idx_customers_phone_unique) and the lookup rides the existingidx_orders_customerindex. No schema change, no migration. The newcustomerHistoryfield onOrderis optional and additive.Related issues
None yet. Happy to open one if you prefer to discuss first.
How to test
npm run typecheckandnpm testin the affected package(s)Checklist
feat:,fix:,chore:,docs:, ...)Areas affected
cod-shared / cod-server / cod-client-astro