B2: profile + notification_preferences + SMS consent capture (TCPA)

- notification_preferences table (user_id PK->users, email/sms toggles,
  sms_consent_at/source/ip evidence, quiet hours, digest) + migration 0002
- src/domain/consent.ts: pure TCPA rule (phoneChanged/buildConsent/resetConsent)
- src/db/profile.ts: updateProfile (partial update; resets consent on phone
  change) + setSmsConsent (opt-in) + getProfile
- PATCH/POST /api/dev/profile routes
- seed: per-user prefs row (email on, SMS off)
- 6 unit tests named after the rules
This commit is contained in:
Tiel Coder
2026-11-18 00:09:05 +00:00
parent 5f0b94af6a
commit 26b31978e2
10 changed files with 1398 additions and 0 deletions
+7
View File
@@ -15,6 +15,13 @@
"when": 1794941123648,
"tag": "0001_fluffy_vivisector",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1794959606685,
"tag": "0002_fearless_doctor_spectrum",
"breakpoints": true
}
]
}