From f8ab69684ab7a92a54b401cd81a4dce3abddcf31 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 13 Apr 2026 18:02:57 +0200 Subject: [PATCH] docs(33): add summaries for plans 01 and 02 (wave 1 complete) Co-Authored-By: Claude Opus 4.6 (1M context) --- .../33-currency-system/33-01-SUMMARY.md | 38 +++++++++++++++++++ .../33-currency-system/33-02-SUMMARY.md | 30 +++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .planning/phases/33-currency-system/33-01-SUMMARY.md create mode 100644 .planning/phases/33-currency-system/33-02-SUMMARY.md diff --git a/.planning/phases/33-currency-system/33-01-SUMMARY.md b/.planning/phases/33-currency-system/33-01-SUMMARY.md new file mode 100644 index 0000000..7e22a8f --- /dev/null +++ b/.planning/phases/33-currency-system/33-01-SUMMARY.md @@ -0,0 +1,38 @@ +# 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) diff --git a/.planning/phases/33-currency-system/33-02-SUMMARY.md b/.planning/phases/33-currency-system/33-02-SUMMARY.md new file mode 100644 index 0000000..e5fa2bd --- /dev/null +++ b/.planning/phases/33-currency-system/33-02-SUMMARY.md @@ -0,0 +1,30 @@ +# Plan 33-02 Summary + +**Status:** Complete +**Completed:** 2026-04-13 + +## What Was Built + +Database migration for the new market pricing schema. + +### Key Changes +- Generated migration `0006_remarkable_susan_delgado.sql` with Drizzle Kit +- CREATE TABLE market_prices with foreign keys and unique constraint +- CREATE TABLE community_prices with foreign keys and unique constraint +- ALTER TABLE items ADD COLUMN price_currency (default 'EUR') +- ALTER TABLE thread_candidates ADD COLUMN found_price_cents, found_price_currency, found_price_date + +### Key Files Created +- `drizzle-pg/0006_remarkable_susan_delgado.sql` — Migration SQL +- `drizzle-pg/meta/0006_snapshot.json` — Schema snapshot + +## Self-Check: PASSED + +- [x] Migration SQL contains CREATE TABLE market_prices +- [x] Migration SQL contains CREATE TABLE community_prices +- [x] Migration SQL contains ALTER TABLE items ADD COLUMN price_currency +- [x] Migration SQL contains ALTER TABLE thread_candidates ADD COLUMN found_price_cents + +## Notes +- db:push requires a running PostgreSQL instance — migration will be applied on deployment +- Migration is additive only (new tables, new nullable columns) — no data migration needed