1.7 KiB
1.7 KiB
Plan 33-01 Summary
Status: Complete Completed: 2026-04-13
What Was Built
Database schema foundation for market-aware pricing and a currency conversion service.
Key Changes
- Added
market_pricestable (globalItemId, market, currency, priceCents, source) with unique constraint - Added
community_pricestable (globalItemId, userId, market, currency, priceCents, priceDate, sourceType) with unique constraint - Added
priceCurrencycolumn to items table (default 'EUR') - Added
foundPriceCents,foundPriceCurrency,foundPriceDatecolumns to thread_candidates - Created currency.service.ts with frankfurter.app rate fetching, 24h caching, and conversion math
- Added Zod schemas for market price and community price validation
- Exported new types (MarketPrice, CommunityPrice, UpsertMarketPrice, SubmitCommunityPrice)
Key Files Created/Modified
src/db/schema.ts— New tables + columnssrc/shared/schemas.ts— New validation schemassrc/shared/types.ts— New type exportssrc/server/services/currency.service.ts— Exchange rate servicetests/services/currency.service.test.ts— 12 unit tests
Self-Check: PASSED
- market_prices table defined with correct columns and constraint
- community_prices table defined with correct columns and constraint
- items.priceCurrency column added
- threadCandidates foundPrice fields added
- Currency service fetches, caches, converts
- All 12 tests pass
Decisions Made
- Used separate tables for market prices and community prices (not JSONB)
- EUR as default price currency matching existing data assumption
- Module-level caching for exchange rates (simple, effective for single-process)