feat(invitations): check contact grants on every read, cap pending invitations, and expire them at the deadline

This commit is contained in:
shira committed 2026-10-09 19:06:50 +03:00
1 parent 676b3c6e24
commit 12a7213d4a
67 files changed
+4255 -149

No files matched your search

@@ -0,0 +1,13 @@
-- The time of the latest decline of one candidate by one organization, across
-- every need and every member of the organization. The pause that follows it is
-- applied by the send, from the policy in force. A candidate without a decline
-- finds no row.
-- name: LatestInvitationDecline :one
SELECT responded_at AS declined_at
FROM invitations
WHERE
organization_id = sqlc.arg(organization_id)
AND candidate_id = sqlc.arg(candidate_id)
AND state = 'declined'
ORDER BY responded_at DESC
LIMIT 1;