completionId: cgen-e86110a4e7db406fb2e0a6421eebcc2c
cgen-e86110a4e7db406fb2e0a6421eebcc2c
This commit is contained in:
parent
710788acb0
commit
629814caed
1 changed files with 23 additions and 0 deletions
|
|
@ -309,6 +309,29 @@ export const aethexUserService = {
|
||||||
return await ensureDailyStreakForProfile(normalized);
|
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> {
|
async getProfileById(userId: string): Promise<AethexUserProfile | null> {
|
||||||
if (!userId) return null;
|
if (!userId) return null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue