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.

Filter out expired bounties in on the partner profile (#3334)

Marcus Farrell96b0f7bd8b09
diff --git a/apps/web/app/(ee)/api/bounties/route.ts b/apps/web/app/(ee)/api/bounties/route.ts
index 6781c8e6b8..0584499acb 100644
--- a/apps/web/app/(ee)/api/bounties/route.ts
+++ b/apps/web/app/(ee)/api/bounties/route.ts
@@ -52,20 +52,29 @@ export const GET = withWorkspace(
programId,
// Filter only bounties the specified partner is eligible for
...(programEnrollment && {
- OR: [
+ AND: [
+ // Filter out expired bounties
{
- groups: {
- none: {},
- },
+ OR: [{ endsAt: null }, { endsAt: { gt: new Date() } }],
},
+ // Filter by partner's group eligibility
{
- groups: {
- some: {
- groupId:
- programEnrollment.groupId ||
- programEnrollment.program.defaultGroupId,
+ OR: [
+ {
+ groups: {
+ none: {},
+ },
},
- },
+ {
+ groups: {
+ some: {
+ groupId:
+ programEnrollment.groupId ||
+ programEnrollment.program.defaultGroupId,
+ },
+ },
+ },
+ ],
},
],
}),