From f7b3913c71a40987c427d7b1719e5273ea6a0763 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 14 Oct 2025 13:34:34 +0200 Subject: [PATCH] :sparkles: Use system clock for check invitation expiration instead of db time --- backend/src/app/rpc/commands/teams.clj | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/src/app/rpc/commands/teams.clj b/backend/src/app/rpc/commands/teams.clj index 18f1f1b5f5..68405f9bc5 100644 --- a/backend/src/app/rpc/commands/teams.clj +++ b/backend/src/app/rpc/commands/teams.clj @@ -443,13 +443,18 @@ [:team-id ::sm/uuid]]) (def sql:team-invitations - "select email_to as email, role, (valid_until < now()) as expired - from team_invitation where team_id = ? order by valid_until desc, created_at desc") + "SELECT email_to AS email, + role, + (valid_until < ?::timestamptz) AS expired + FROM team_invitation + WHERE team_id = ? + ORDER BY valid_until DESC, created_at DESC") (defn get-team-invitations [conn team-id] - (->> (db/exec! conn [sql:team-invitations team-id]) - (mapv #(update % :role keyword)))) + (let [now (ct/now)] + (->> (db/exec! conn [sql:team-invitations now team-id]) + (mapv #(update % :role keyword))))) (sv/defmethod ::get-team-invitations {::doc/added "1.17"