deckhearth/.convoys/pricing-online-local/brief-5-foilio-lorcana-pricing.md

44 lines
1.6 KiB
Markdown
Raw Normal View History

---
convoy: pricing-online-local
brief_number: 5
depends_on: [2]
recommended_model: composer-2.5
model_tier: standard
files:
- lib/pricing/foilio-client.js
- lib/card-import/lorcana-bulk.js
- test/lib/pricing/foilio-client.test.js
- test/lib/card-import/lorcana-bulk.test.js
---
# Brief 5: Foilio Lorcana pricing ingest
## Goal (1 sentence)
Enrich Lorcana bulk sync with hourly Foilio feed prices keyed by card id and name+set.
## Files in scope (do not edit anything else)
- `lib/pricing/foilio-client.js`
- `lib/card-import/lorcana-bulk.js`
- `test/lib/pricing/foilio-client.test.js`
- `test/lib/card-import/lorcana-bulk.test.js`
## Conventions to follow
- Feed URL: `process.env.FOILIO_PRICES_FEED_URL ?? 'https://foilio.net/api/prices/feed?game=lorcana'`.
- Client fetches once per sync run; build `Map` by `card_id` and composite `normalize(name)|set`.
- Extend `buildUpsertQuery` / `mapLorcanaCard` to include `current_price`, `market_price`, `prices_updated_at`.
- Prefer USD fields when present; otherwise EUR with `currency` noted in snapshot.
- `recordPriceSnapshots` with `source: 'foilio'`.
- Preserve existing `scryfall_id = Unique_ID` keying.
## Acceptance criteria
- [ ] Lorcana cards receive prices when feed contains a match
- [ ] Single feed fetch per `runBulkLorcanaSync` invocation
- [ ] Summary includes `pricesMatched` / `unmatchedCount`
- [ ] Tests pass with fixture JSON
- [ ] No scope expansion
## Rationale (≤3 sentences)
Lorcana bulk currently omits price columns entirely. Foilio provides a free hourly JSON feed. One fetch per sync aligns with their 1h cache.