diff --git a/client/lib/aethex-database-adapter.ts b/client/lib/aethex-database-adapter.ts index c84dd802..bd784de3 100644 --- a/client/lib/aethex-database-adapter.ts +++ b/client/lib/aethex-database-adapter.ts @@ -309,6 +309,29 @@ export const aethexUserService = { return await ensureDailyStreakForProfile(normalized); }, + async profileExists(userId: string): Promise { + 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 { if (!userId) return null;