From 27cd950d0bfd6130c9ed7307e804bb4b62bc8603 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 11 Nov 2025 00:30:00 +0000 Subject: [PATCH] completionId: cgen-00c13a0b0b5f43a882273efbd05b3438 cgen-00c13a0b0b5f43a882273efbd05b3438 --- server/index.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/server/index.ts b/server/index.ts index 51de5321..1ba18704 100644 --- a/server/index.ts +++ b/server/index.ts @@ -4340,6 +4340,31 @@ export function createServer() { if (error) throw error; + // Notify applicant of status change + if (data) { + try { + const { data: applicantProfile } = await adminSupabase + .from("aethex_creators") + .select("user_id") + .eq("id", data.creator_id) + .single(); + + if (applicantProfile?.user_id) { + const statusEmoji = status === "accepted" ? "✅" : status === "rejected" ? "❌" : "📝"; + const statusMessage = status === "accepted" ? "accepted" : status === "rejected" ? "rejected" : "updated"; + + await adminSupabase.from("notifications").insert({ + user_id: applicantProfile.user_id, + type: status === "accepted" ? "success" : status === "rejected" ? "error" : "info", + title: `${statusEmoji} Application ${statusMessage}`, + message: response_message || `Your application has been ${statusMessage}.`, + }); + } + } catch (notifError) { + console.warn("Failed to create status notification:", notifError); + } + } + return res.json(data); } catch (e: any) { console.error(