aethex-forge/api/_notifications.ts
Builder.io c8292016cb Update _supabase imports batch 6-10
cgen-895465f01f924459a7291b32c730ce5e
2025-11-16 05:03:13 +00:00

42 lines
964 B
TypeScript

import { getAdminClient } from "./_supabase.js";
export async function createNotification(
userId: string,
type: string,
title: string,
message: string,
): Promise<void> {
try {
const admin = getAdminClient();
await admin.from("notifications").insert({
user_id: userId,
type,
title,
message,
});
} catch (error) {
console.warn("Failed to create notification:", error);
// Non-blocking - don't throw
}
}
export async function notifyAccountLinked(
userId: string,
provider: string,
): Promise<void> {
await createNotification(
userId,
"success",
`🔗 Account Linked: ${provider}`,
`Your ${provider} account has been successfully linked.`,
);
}
export async function notifyOnboardingComplete(userId: string): Promise<void> {
await createNotification(
userId,
"success",
"🎉 Welcome to AeThex!",
"You've completed your profile setup. Let's get started!",
);
}