From b52d326f7b63e13781367b8e4a64126d6ac3d642 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 1 Oct 2025 14:10:14 +0000 Subject: [PATCH] Update Novu migration to include username --- supabase/functions/migrate-novu-users/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/supabase/functions/migrate-novu-users/index.ts b/supabase/functions/migrate-novu-users/index.ts index 6cedf1d9..b07a3ddd 100644 --- a/supabase/functions/migrate-novu-users/index.ts +++ b/supabase/functions/migrate-novu-users/index.ts @@ -38,10 +38,10 @@ serve(async (req) => { const existingUserIds = existingPrefs?.map(p => p.user_id) || []; - // Fetch all profiles + // Fetch all profiles with usernames let query = supabase .from('profiles') - .select('user_id'); + .select('user_id, username'); // Only add the not filter if there are existing user IDs if (existingUserIds.length > 0) { @@ -96,6 +96,7 @@ serve(async (req) => { try { const subscriber = await novu.subscribers.identify(profile.user_id, { email, + firstName: profile.username, data: { userId: profile.user_id }, }); @@ -110,6 +111,7 @@ serve(async (req) => { results.push({ userId: profile.user_id, email, + username: profile.username, success: true, }); } catch (error: any) {