backend: per-user settings store (/api/settings) + enable account deletion

- user_settings table (userId PK -> user, jsonb preferences) + migration
- GET/PUT /api/settings (requireAuth, user-scoped; zod-validated flat map)
- Better Auth user.deleteUser enabled so users can delete their own account

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalid Abdi
2026-06-10 20:05:34 +03:00
parent da245b8758
commit 50fbb6cd40
9 changed files with 2636 additions and 0 deletions
+8
View File
@@ -43,6 +43,14 @@ export const auth = betterAuth({
},
},
user: {
// Lets a signed-in user delete their own account from Settings. The
// frontend confirms with the user's password (authClient.deleteUser).
deleteUser: {
enabled: true,
},
},
emailVerification: {
sendOnSignUp: true,
autoSignInAfterVerification: true,