From 70771dc21c33c22c9791db4c1729f8cc58bf58dc Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Mon, 10 Nov 2025 23:55:41 +0000 Subject: [PATCH] completionId: cgen-7225407d65ee4c9786fdc789d96ca389 cgen-7225407d65ee4c9786fdc789d96ca389 --- client/lib/aethex-database-adapter.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/lib/aethex-database-adapter.ts b/client/lib/aethex-database-adapter.ts index b20fe86a..94c3bcd4 100644 --- a/client/lib/aethex-database-adapter.ts +++ b/client/lib/aethex-database-adapter.ts @@ -910,6 +910,7 @@ export const aethexAchievementService = { const newTotalXP = (currentProfile.total_xp || 0) + xpDelta; const newLevel = Math.floor(newTotalXP / 1000) + 1; const newLoyaltyPoints = (currentProfile.loyalty_points || 0) + xpDelta; + const oldLevel = currentProfile.level || 1; const updates: Record = {}; if ("total_xp" in currentProfile) updates.total_xp = newTotalXP; @@ -924,6 +925,19 @@ export const aethexAchievementService = { .eq("id", userId); if (updateError) throw updateError; + + if (newLevel > oldLevel) { + try { + await aethexNotificationService.createNotification( + userId, + "success", + `⬆️ Level Up!`, + `You've reached level ${newLevel}! Keep it up!`, + ); + } catch (notifError) { + console.warn("Failed to create level up notification:", notifError); + } + } } },