From 27a7767e2239833ce10499836529798ad380dda8 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 4 Oct 2025 10:39:19 +0000 Subject: [PATCH] Include streak fields on initial profile insert cgen-0b7d8962e6af464680c42628fe52c178 --- client/lib/aethex-database-adapter.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/lib/aethex-database-adapter.ts b/client/lib/aethex-database-adapter.ts index f57a449f..f143a2af 100644 --- a/client/lib/aethex-database-adapter.ts +++ b/client/lib/aethex-database-adapter.ts @@ -376,7 +376,10 @@ export const aethexUserService = { .from("user_profiles") .insert({ id: userId, - username: profileData.username || `user_${Date.now()}`, + username: + profileData.username || + (email ? email.split("@")[0] : undefined) || + `user_${Date.now()}`, user_type: (profileData as any).user_type || "community_member", experience_level: (profileData as any).experience_level || "beginner", full_name: profileData.full_name, @@ -389,8 +392,11 @@ export const aethexUserService = { banner_url: (profileData as any).banner_url, level: 1, total_xp: 0, - created_at: new Date().toISOString(), - updated_at: new Date().toISOString(), + current_streak: 1, + longest_streak: 1, + last_streak_at: todayIso, + created_at: nowIso, + updated_at: nowIso, }) .select() .single();