Files
loki/scripts
g-butandClaude Opus 4.7 00735be6a0 refactor(money): $type<> currency + frequency, drop "one-time" literal outlier
Final pair of text columns missing `.$type<>()`:

- subscriptions.currency: now $type<SubscriptionCurrency>(). The
  literal "CHF" default stays as-is — it's already the canonical
  default and the type is ["CHF","USD","EUR","GBP"], so the literal
  cannot drift.
- subscriptions.frequency: now $type<SubscriptionFrequency>() with
  the default routed through FREQUENCY.MONTHLY (SSOT).

Side-effects:
- Both subscriptions API routes' `CURRENCIES_ENUM` and
  `FREQUENCIES_ENUM` were typed `readonly [string, ...string[]]`,
  so z.enum widened to string and the tightened `.set()` rejected
  it. Tightened to the typed tuples — matches what every other
  enum cast in /api now does.
- scripts/seed.ts gains two boundary casts for sqlite legacy data.
- SubscriptionActions had `frequency === "one-time"` — the only
  literal outlier in that file (every other branch already used
  FREQUENCY.X). Now also goes through FREQUENCY.ONE_TIME.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 22:49:13 +02:00
..