-- name: RevokeAllActiveTeamRefreshTokensForMember :exec
UPDATE team_refresh_tokens
SET revoked = TRUE
WHERE team_member_id = $1
  AND revoked = FALSE;

-- name: CreateTeamRefreshToken :exec
INSERT INTO team_refresh_tokens (team_member_id, token, expires_at, revoked, created_at)
VALUES ($1, $2, $3, $4, $5);

-- name: GetTeamRefreshTokenByToken :one
SELECT *
FROM team_refresh_tokens
WHERE token = $1;

-- name: RevokeTeamRefreshTokenByToken :exec
UPDATE team_refresh_tokens
SET revoked = TRUE
WHERE token = $1;
