39 lines
1.7 KiB
Markdown
39 lines
1.7 KiB
Markdown
# 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_prices` table (globalItemId, market, currency, priceCents, source) with unique constraint
|
|
- Added `community_prices` table (globalItemId, userId, market, currency, priceCents, priceDate, sourceType) with unique constraint
|
|
- Added `priceCurrency` column to items table (default 'EUR')
|
|
- Added `foundPriceCents`, `foundPriceCurrency`, `foundPriceDate` columns 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 + columns
|
|
- `src/shared/schemas.ts` — New validation schemas
|
|
- `src/shared/types.ts` — New type exports
|
|
- `src/server/services/currency.service.ts` — Exchange rate service
|
|
- `tests/services/currency.service.test.ts` — 12 unit tests
|
|
|
|
## Self-Check: PASSED
|
|
|
|
- [x] market_prices table defined with correct columns and constraint
|
|
- [x] community_prices table defined with correct columns and constraint
|
|
- [x] items.priceCurrency column added
|
|
- [x] threadCandidates foundPrice fields added
|
|
- [x] Currency service fetches, caches, converts
|
|
- [x] 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)
|