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.

keep syncing social metrics for existing bounty submissions

Pedro Ladeiraa5dc2d152371
diff --git a/apps/web/app/(ee)/api/cron/bounties/sync-social-metrics/route.ts b/apps/web/app/(ee)/api/cron/bounties/sync-social-metrics/route.ts
index b071005a31..dd84674a01 100644
--- a/apps/web/app/(ee)/api/cron/bounties/sync-social-metrics/route.ts
+++ b/apps/web/app/(ee)/api/cron/bounties/sync-social-metrics/route.ts
@@ -1,7 +1,3 @@
-import {
- bountyEligibilityIncludes,
- isPartnerEligibleForBounty,
-} from "@/lib/bounty/api/bounty-availability";
import { getSocialMetricsUpdates } from "@/lib/bounty/api/get-social-metrics-updates";
import { isBountyEnded } from "@/lib/bounty/bounty-period";
import { hasReachedSocialMetricsEarningCap } from "@/lib/bounty/social-metrics-milestones";
@@ -37,13 +33,11 @@ export const POST = withCron(async ({ rawBody }) => {
id: bountyId,
},
include: {
- ...bountyEligibilityIncludes,
program: {
select: {
name: true,
slug: true,
supportEmail: true,
- defaultGroupId: true,
},
},
},
@@ -96,14 +90,7 @@ export const POST = withCron(async ({ rawBody }) => {
},
programEnrollment: {
select: {
- createdAt: true,
- groupId: true,
- status: true,
- programPartnerTags: {
- select: {
- partnerTagId: true,
- },
- },
+ partnerId: true,
},
},
},
@@ -130,15 +117,7 @@ export const POST = withCron(async ({ rawBody }) => {
return false;
}
- if (hasReachedSocialMetricsEarningCap({ bounty, submission })) {
- return false;
- }
-
- return isPartnerEligibleForBounty({
- program: bounty.program,
- bounty,
- programEnrollment: submission.programEnrollment,
- });
+ return !hasReachedSocialMetricsEarningCap({ bounty, submission });
});
let syncedCount = 0;