Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update route.ts

Kiran K57479231ba91
diff --git a/apps/web/app/(ee)/api/cron/rewards/process/route.ts b/apps/web/app/(ee)/api/cron/rewards/process/route.ts
index a9fa6e0ace..0ba9ea0ced 100644
--- a/apps/web/app/(ee)/api/cron/rewards/process/route.ts
+++ b/apps/web/app/(ee)/api/cron/rewards/process/route.ts
@@ -111,6 +111,14 @@ export const POST = withCron(async ({ rawBody }) => {
switch (event) {
case "reward-created":
+ // Assign only inheritors: no reward yet, or still pointing at a
+ // soft-deleted default (programId null).
+ where = {
+ OR: [
+ { [rewardIdColumn]: null },
+ { [rewardRelation]: { is: { programId: null } } },
+ ],
+ };
data = { [rewardIdColumn]: reward.id };
break;