Use system clock for check invitation expiration

instead of db time
This commit is contained in:
Andrey Antukh
2025-10-14 13:34:34 +02:00
parent 85591bd579
commit f7b3913c71

View File

@@ -443,13 +443,18 @@
[:team-id ::sm/uuid]]) [:team-id ::sm/uuid]])
(def sql:team-invitations (def sql:team-invitations
"select email_to as email, role, (valid_until < now()) as expired "SELECT email_to AS email,
from team_invitation where team_id = ? order by valid_until desc, created_at desc") role,
(valid_until < ?::timestamptz) AS expired
FROM team_invitation
WHERE team_id = ?
ORDER BY valid_until DESC, created_at DESC")
(defn get-team-invitations (defn get-team-invitations
[conn team-id] [conn team-id]
(->> (db/exec! conn [sql:team-invitations team-id]) (let [now (ct/now)]
(mapv #(update % :role keyword)))) (->> (db/exec! conn [sql:team-invitations now team-id])
(mapv #(update % :role keyword)))))
(sv/defmethod ::get-team-invitations (sv/defmethod ::get-team-invitations
{::doc/added "1.17" {::doc/added "1.17"