Files
lincodex/backend/db/queries/invitation_cooldowns.sql

14 lines
510 B
SQL

-- 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;