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>
46 lines
1.6 KiB
Markdown
46 lines
1.6 KiB
Markdown
---
|
|
convoy: pricing-online-local
|
|
brief_number: 7
|
|
depends_on: [2, 6]
|
|
recommended_model: composer-2.5
|
|
model_tier: standard
|
|
files:
|
|
- pages/api/cards/owned.js
|
|
- pages/api/collections/[identifier]/cards.js
|
|
- lib/use-collection-view.js
|
|
- components/CollectionPageView.js
|
|
- pages/my-cards.js
|
|
- test/api/cards-owned-sort.test.js
|
|
---
|
|
|
|
# Brief 7: Sort by price wiring
|
|
|
|
## Goal (1 sentence)
|
|
|
|
Wire “Sort by Price” through owned-cards and list APIs into collection and My Collection UIs.
|
|
|
|
## Files in scope (do not edit anything else)
|
|
- `pages/api/cards/owned.js`
|
|
- `pages/api/collections/[identifier]/cards.js`
|
|
- `lib/use-collection-view.js`
|
|
- `components/CollectionPageView.js`
|
|
- `pages/my-cards.js`
|
|
- `test/api/cards-owned-sort.test.js`
|
|
|
|
## Conventions to follow
|
|
- Query params: `sort=name|price|rarity|date`, `order=asc|desc` (default `name`/`asc`).
|
|
- Price sort uses `listUnitPriceExpr` or `COALESCE(c.current_price, c.market_price)`; NULLs last.
|
|
- `CollectionPageView` select options must use stable values (`name`, `price`, etc.) not display strings.
|
|
- Server-side sort required for paginated My Collection.
|
|
|
|
## Acceptance criteria
|
|
- [ ] `/api/cards/owned?sort=price&order=desc` orders by effective price
|
|
- [ ] Collection cards API supports same params
|
|
- [ ] UI sort dropdown changes card order
|
|
- [ ] API test asserts ORDER BY clause or result ordering
|
|
- [ ] Tests pass
|
|
- [ ] No scope expansion
|
|
|
|
## Rationale (≤3 sentences)
|
|
|
|
Sort UI exists but is inert. Server-side sort avoids loading entire collections client-side. Depends on valuation helpers for consistent price column.
|