-
-
Notifications
You must be signed in to change notification settings - Fork 135
feat(backend): track first organization onboarding in Bento #2841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
65c620c
feat(backend): track first organization lifecycle in Bento
WcaleNieWolny d61580a
test(backend): strengthen Bento lifecycle coverage
WcaleNieWolny 6c6f9f6
fix(backend): harden Bento lifecycle updates
WcaleNieWolny 526bd93
fix(backend): fix Bento lifecycle ordering
WcaleNieWolny b25a1ff
fix(backend): require one queued Bento email change
WcaleNieWolny 0ef08e6
fix(backend): suppress first-org recovery on email changes
WcaleNieWolny cda36d1
docs: document first-org recovery safety guard
WcaleNieWolny 03b4509
feat(db): queue active organization access changes
WcaleNieWolny a543df5
fix(backend): harden first-org lifecycle ordering
WcaleNieWolny 56cd6e1
fix(backend): address first-org review findings
WcaleNieWolny 8811d6a
fix(backend): harden first-org trigger validation
WcaleNieWolny 15f704b
fix(backend): harden onboarding deletion races
WcaleNieWolny 335af5b
fix(backend): harden onboarding cleanup retries
WcaleNieWolny 0154b7c
fix(backend): reconcile Bento deletion races
WcaleNieWolny 7df4311
test(backend): assert lock-timeout provisioning
WcaleNieWolny f24c3c1
fix(backend): abort timed-out Bento cleanup
WcaleNieWolny 4d0f4d2
test(backend): prove Bento abort ordering
WcaleNieWolny 6c3f285
fix(backend): preserve Bento reconciliation errors
WcaleNieWolny 476cade
fix(backend): harden Bento lifecycle ordering
WcaleNieWolny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
supabase/functions/_backend/triggers/on_user_org_access.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import type { Database } from '../utils/supabase.types.ts' | ||
| import { z } from 'zod' | ||
| import { syncBentoFirstOrgOnRoleBindingWrite } from '../utils/bento_first_org.ts' | ||
| import { BRES, createHono, middlewareAPISecret, simpleError, triggerValidator } from '../utils/hono.ts' | ||
| import { version } from '../utils/version.ts' | ||
|
|
||
| export const app = createHono('', version) | ||
|
|
||
| app.post('/', middlewareAPISecret, triggerValidator('role_bindings', ['INSERT', 'UPDATE']), async (c) => { | ||
| const record = c.get('webhookBody') as Partial<Database['public']['Tables']['role_bindings']['Row']> | ||
| const bindingId = z.uuid().safeParse(record.id) | ||
| if (!bindingId.success) | ||
| throw simpleError('invalid_payload', 'Invalid role binding id', { id: record.id }) | ||
|
|
||
| await syncBentoFirstOrgOnRoleBindingWrite(c, bindingId.data) | ||
| return c.json(BRES) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.