Include streak fields on initial profile insert

cgen-0b7d8962e6af464680c42628fe52c178
This commit is contained in:
Builder.io 2025-10-04 10:39:19 +00:00
parent bae824507f
commit 27a7767e22

View file

@ -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();