feat(accounts): add consent settings and organization management
This commit is contained in:
1 parent
24638d46d2
commit
391af7a1ef
83 files changed
+10198
-613
No files matched your search
@@ -280,6 +280,25 @@ ORDER BY granted_at DESC, id DESC
|
||||
LIMIT 1
|
||||
FOR SHARE;
|
||||
|
||||
-- Locks the candidate's published row only when it refers to a C2 record
|
||||
-- revoked by this transaction. The setting remains linked to that immutable
|
||||
-- record; ReadCandidatePublication computes the effective closed state and
|
||||
-- keeps the consent-revoked reason after later grants. The returned time is
|
||||
-- the effective close time used by the privacy history event.
|
||||
-- name: LockCandidatePublicationForConsentRevocation :one
|
||||
SELECT greatest(candidate_publications.published_at, consent_records.revoked_at)::timestamptz AS closed_at
|
||||
FROM candidate_publications
|
||||
INNER JOIN consent_records
|
||||
ON consent_records.id = candidate_publications.consent_record_id
|
||||
WHERE
|
||||
candidate_publications.user_id = sqlc.arg(user_id)
|
||||
AND candidate_publications.state = 'published'
|
||||
AND consent_records.id = ANY(sqlc.arg(consent_record_ids)::uuid [])
|
||||
AND consent_records.subject_id = candidate_publications.user_id
|
||||
AND consent_records.purpose = 'c2'
|
||||
AND consent_records.revoked_at IS NOT NULL
|
||||
FOR UPDATE OF candidate_publications;
|
||||
|
||||
-- The organization-facing read of a candidate's publication: the effective
|
||||
-- view (published and backed by an unrevoked C2) and no hiding of the reading
|
||||
-- organization. No row means the organization reads nothing, whichever of
|
||||
|
||||
Reference in new issue
Block a user