Normalize current user return

cgen-bc45884aaf6b4b22823236e6fe84d754
This commit is contained in:
Builder.io 2025-10-04 10:38:23 +00:00
parent 63cb1a4642
commit a7e8b61199

View file

@ -253,20 +253,18 @@ export const aethexUserService = {
}
if (!data || Object.keys(data || {}).length === 0) {
return await this.createInitialProfile(user.id, {
username: user.email?.split("@")[0] || "user",
full_name: user.email?.split("@")[0] || "user",
});
return await this.createInitialProfile(
user.id,
{
username: user.email?.split("@")[0] || "user",
full_name: user.email?.split("@")[0] || "user",
},
user.email,
);
}
return {
...data,
email: user.email,
username: (data as any).username || user.email?.split("@")[0] || "user",
onboarded: true,
role: "member",
loyalty_points: 0,
} as AethexUserProfile;
const normalized = normalizeProfile(data, user.email);
return await ensureDailyStreakForProfile(normalized);
},
async getProfileById(userId: string): Promise<AethexUserProfile | null> {