feat(invitations): accept invitations with C4 consent and contact grants; share the E0 quota across holdings
This commit is contained in:
1 parent
a5990d3fc6
commit
676b3c6e24
59 files changed
+4926
-194
No files matched your search
@@ -0,0 +1,45 @@
|
||||
-- Store the contact grant of an acceptance. The row is inserted in the same
|
||||
-- transaction as its C4 consent record and the accepted state; the database
|
||||
-- checks that the record, the invitation, and the candidate agree.
|
||||
-- name: InsertContactGrant :exec
|
||||
INSERT INTO contact_grants (
|
||||
id,
|
||||
organization_id,
|
||||
candidate_id,
|
||||
source_invitation_id,
|
||||
consent_record_id,
|
||||
terms_version,
|
||||
fields,
|
||||
consent_text_version,
|
||||
granted_at
|
||||
) VALUES (
|
||||
sqlc.arg(id),
|
||||
sqlc.arg(organization_id),
|
||||
sqlc.arg(candidate_id),
|
||||
sqlc.arg(source_invitation_id),
|
||||
sqlc.arg(consent_record_id),
|
||||
sqlc.arg(terms_version),
|
||||
sqlc.arg(fields)::text [],
|
||||
sqlc.arg(consent_text_version),
|
||||
sqlc.arg(granted_at)
|
||||
);
|
||||
|
||||
-- Read the grant of one invitation of one organization. An invitation of
|
||||
-- another organization finds nothing.
|
||||
-- name: GetContactGrantByInvitation :one
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
candidate_id,
|
||||
source_invitation_id,
|
||||
consent_record_id,
|
||||
terms_version,
|
||||
fields,
|
||||
consent_text_version,
|
||||
granted_at,
|
||||
revoked_at,
|
||||
revocation_reason
|
||||
FROM contact_grants
|
||||
WHERE
|
||||
organization_id = sqlc.arg(organization_id)
|
||||
AND source_invitation_id = sqlc.arg(invitation_id);
|
||||
Reference in new issue
Block a user