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.9 KiB
1.9 KiB
| convoy | brief_number | depends_on | recommended_model | model_tier | files | cross_brief_commitments | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| pricing-online-local | 8 |
|
composer-2.5 | standard |
|
|
Brief 8: Card pricing + history APIs
Goal (1 sentence)
Expose GET /api/cards/[id]/pricing and GET /api/cards/[id]/price-history reading DB with optional stale refresh.
Files in scope (do not edit anything else)
lib/pricing/pricing-service.jspages/api/cards/[id]/pricing.jspages/api/cards/[id]/price-history.jspages/api/cards/[id].jstest/api/cards-pricing.test.jstest/api/cards-price-history.test.js
Conventions to follow
- API route pattern from
.cursor/rules/api-routes.mdc: method gate, try/catch, manual validation. pricing-service.js: DB-first; live refresh only when stale >24h with Redis single-flight lock.- Include
outboundlinks viaoutbound-links.js. price-history.jsAPI: querycard_price_historylast N days (default 90, max 365).
Acceptance criteria
GET /api/cards/123/pricingreturns prices +pricesUpdatedAt+stalebooleanGET /api/cards/123/price-history?days=30returns{ points: [...] }- 404 when card missing; 400 on invalid id/days
- Live refresh does not throw on upstream failure
- Tests pass
- No scope expansion
Rationale (≤3 sentences)
Phase 1 backend contract for Purchase and Price History tabs. DB-first path respects free API limits; 24h staleness matches convoy spec.