Commit b06b4ea
authored
Delete user edge function (#2829)
* feat: create oauth client utilities for mining-sources edge function
* fix: address code review issues - pin deps, add guards, fix types
* feat: create mining-sources edge function with OAuth routes
* fix: address code review issues - add onError handler, fix credentials JSON, add getRequiredEnv
* test: add tests for mining-sources utility functions and route schemas
* test: extract schemas to shared module, strengthen test assertions, add edge cases
* feat: update frontend to call mining-sources edge function
* chore: remove deprecated Express OAuth routes and methods
* chore: remove deprecated add-mining-source edge function (replaced by mining-sources)
* test: remove deprecated OAuth helper tests (functionality moved to edge function)
* fix: resolve CI lint and DeepSource issues
* feat: make oauth_callback_base_url a required env var with no fallbacks
* docs: mark oauth_callback_base_url as required in env template
* feat: add mining-sources config and document oauth_callback_base_url env var
* fix: hmac-sign oauth state to prevent userId forgery
* feat: add callbackQuerySchema for oauth callback route validation
* test: add callbackQuerySchema tests
* feat: use zod validation for oauth callback route params
* chore: remove orphaned validator schemas and stale add-mining-source directory
* fix: remove dead OAuth code from mining controller (post-merge cleanup)
* feat: add create_smtp_sender_for_oauth rpc for smtp twin creation
* feat: add smtp twin creation to mining-sources edge function callback
* test: add smtp twin creation tests for mining-sources edge function
* chore: remove plan docs from remote
* chore: remove workmux config from remote
* fix: use const instead of let for accessToken/refreshToken (deepsource)
* feat: create delete-user edge function
Move user account deletion from Express backend to a new Supabase
edge function. The edge function verifies the user via JWT, calls the
delete_user_data RPC, then deletes the auth user via admin API.
Closes #2810
* feat(frontend): call delete-user edge function from settings
Replace direct Express API call ($api) with the new delete-user
edge function ($saasEdgeFunctions) for account deletion.
* refactor(backend): remove Express delete-user code
The auth controller, user resolver interface and implementation, and
related wiring (auth routes, app, server) are no longer needed since
the delete-user edge function handles account deletion.
* fix(delete-user): pass JWT explicitly to auth.getUser()
The default auth.getUser() call has a known issue where it may
return null user data when called from an Edge Function with no
Supabase session. Pass the JWT explicitly to avoid silently 401ing
real users.
Also drop the unused getRequiredEnv import.
* fix(delete-user): explicit return on authMiddleware to satisfy DeepSource JS-00451 parent 4b3cef2 commit b06b4ea
12 files changed
Lines changed: 238 additions & 164 deletions
File tree
- backend/src
- controllers
- db
- interfaces
- supabase
- routes
- frontend/src/pages/account
- supabase/functions
- add-mining-source
- delete-user
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | 2 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 3 | + | |
11 | 4 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 5 | | |
17 | 6 | | |
18 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments