Enrich Supabase profile fetch with fallback email

cgen-8f8fbe1f4d59475e9eabbf18a3b1a768
This commit is contained in:
Builder.io 2025-09-30 22:09:29 +00:00
parent d496c22423
commit 4c670092e4

View file

@ -193,7 +193,15 @@ export const aethexUserService = {
throw error;
}
return data as AethexUserProfile;
let enriched = data as AethexUserProfile;
if (!enriched.email) {
const mock = await mockAuth.getUserProfile(userId as any);
if (mock?.email) {
enriched = { ...enriched, email: mock.email } as AethexUserProfile;
}
}
return enriched;
},
async listProfiles(limit = 50): Promise<AethexUserProfile[]> {
@ -541,7 +549,7 @@ export const aethexAchievementService = {
id: "ach_level_master",
name: "Level Master",
description: "Reached level 5",
icon: "<EFBFBD><EFBFBD>",
icon: "🏆",
xp_reward: 250,
badge_color: "#f59e0b",
created_at: new Date().toISOString(),