feat: add assessment, privacy and support flows
This commit is contained in:
1 parent
ee3738ee73
commit
e4f24fa202
339 files changed
+56454
-1126
No files matched your search
@@ -97,6 +97,32 @@ WHERE
|
||||
AND membership.user_id = sqlc.arg(user_id)
|
||||
AND membership.state = 'active';
|
||||
|
||||
-- Locks the organization first and then the active membership, using the
|
||||
-- same order as organization profile writes. A company operation keeps both
|
||||
-- share locks until its transaction commits, so a concurrent revocation
|
||||
-- cannot authorize a write after it has committed.
|
||||
-- name: LockActiveMembership :one
|
||||
WITH locked_organization AS MATERIALIZED (
|
||||
SELECT organizations.id
|
||||
FROM organizations
|
||||
WHERE organizations.id = sqlc.arg(organization_id)
|
||||
FOR SHARE
|
||||
)
|
||||
SELECT
|
||||
membership.id AS membership_id,
|
||||
membership.organization_id,
|
||||
membership.user_id,
|
||||
membership.role,
|
||||
membership.state,
|
||||
membership.created_at,
|
||||
membership.updated_at
|
||||
FROM memberships AS membership
|
||||
INNER JOIN locked_organization ON locked_organization.id = membership.organization_id
|
||||
WHERE
|
||||
membership.user_id = sqlc.arg(user_id)
|
||||
AND membership.state = 'active'
|
||||
FOR SHARE OF membership;
|
||||
|
||||
-- Changes the profile of an organization over the version the caller read
|
||||
-- and advances the version in the same statement. It names no verification
|
||||
-- column, so a profile update cannot move the trust level. The change
|
||||
|
||||
Reference in new issue
Block a user