completionId: cgen-e86110a4e7db406fb2e0a6421eebcc2c

cgen-e86110a4e7db406fb2e0a6421eebcc2c
This commit is contained in:
Builder.io 2025-11-16 08:41:01 +00:00
parent 710788acb0
commit 629814caed

View file

@ -309,6 +309,29 @@ export const aethexUserService = {
return await ensureDailyStreakForProfile(normalized);
},
async profileExists(userId: string): Promise<boolean> {
if (!userId) return false;
ensureSupabase();
const { data, error } = await supabase
.from("user_profiles")
.select("id")
.eq("id", userId)
.single();
if (error) {
if ((error as any)?.code === "PGRST116") {
return false;
}
// Log other errors but don't throw
console.warn("[Profile] Error checking profile existence:", error);
return false;
}
return !!data?.id;
},
async getProfileById(userId: string): Promise<AethexUserProfile | null> {
if (!userId) return null;