Fix bot review

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-18 17:41:09 +04:00
parent 9941a6a66a
commit 776af96170
7 changed files with 21 additions and 112 deletions

View File

@@ -30,7 +30,7 @@ import (
type (
Invitation struct {
ID gid.GID `db:"id"`
OrganizationID gid.GID `fb:"organization_id"`
OrganizationID gid.GID `db:"organization_id"`
UserID gid.GID `db:"user_id"`
Status InvitationStatus `db:"status"`
ExpiresAt time.Time `db:"expires_at"`

View File

@@ -78,11 +78,15 @@ FROM
WHERE
accepted_at IS NULL
ORDER BY
email
email,
created_at DESC
) i ON CONFLICT (email_address) DO
UPDATE
SET
full_name = EXCLUDED.full_name;
full_name = COALESCE(
NULLIF(identities.full_name, ''),
EXCLUDED.full_name
);
-- Create missing profiles
WITH invitation_identities AS (
@@ -193,7 +197,8 @@ WITH orphan_invitations AS (
LEFT JOIN identities i ON i.email_address = inv.email
LEFT JOIN iam_membership_profiles p ON p.identity_id = i.id
WHERE
i.id IS NULL OR p.id IS NULL
i.id IS NULL
OR p.id IS NULL
)
DELETE FROM
iam_invitations
@@ -218,4 +223,4 @@ ALTER COLUMN
ALTER COLUMN
role DROP NOT NULL,
ALTER COLUMN
full_name DROP NOT NULL;
full_name DROP NOT NULL;