deckhearth/.convoys/pricing-online-local/brief-7-sort-by-price.md
Randall Stillwell d0468015eb
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
feat(pricing): convoy for online prices and local stores
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>
2026-09-08 22:47:46 -05:00

1.6 KiB

convoy brief_number depends_on recommended_model model_tier files
pricing-online-local 7
2
6
composer-2.5 standard
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.