Some checks failed
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
Visual diff / Should run? (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Should run? (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
Visual diff / Screenshot diff (pull_request) Has been cancelled
Add pricing schema, free API integrations (MTG bulk, TCGdex, Foolio), valuation and sort-by-price, card detail pricing UI, and nearby store discovery via home zip and OSM geo clients. Co-authored-by: Cursor <cursoragent@cursor.com>
1.5 KiB
1.5 KiB
| convoy | brief_number | depends_on | recommended_model | model_tier | files | ||||
|---|---|---|---|---|---|---|---|---|---|
| pricing-online-local | 6 |
|
composer-2.5 | standard |
|
Brief 6: Foil-aware valuation APIs
Goal (1 sentence)
Fix collection total value to use nonfoil current_price for user_cards.is_foil = false rows.
Files in scope (do not edit anything else)
pages/api/user/stats.jspages/api/collections/[identifier].jstest/api/user-stats-valuation.test.js
Conventions to follow
- Import
effectiveUnitPriceExprandlistUnitPriceExprfromlib/pricing/collection-valuation.js. stats.js: replacecards.market_price * quantitywith effective unit price expression in value, game breakdown, rarity breakdown, and recent activity.collections/[identifier].js: replaceSUM(cards.market_price * cc.quantity)withlistUnitPriceExpr.- Auth pattern unchanged (
getUserFromRequest).
Acceptance criteria
- Nonfoil
user_cardsrow valued atcurrent_price, not foilmarket_price - Foil row still uses
market_price - Collection list totals use
COALESCE(current_price, market_price) - Regression test locks MTG foil/nonfoil scenario
- Tests pass
- No scope expansion
Rationale (≤3 sentences)
This is the user-visible valuation bug from Phase 0. market_price stores Scryfall usd_foil for MTG. Fixing at the API layer immediately improves dashboard and profile totals.