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.

Add groups handling and set disabledAt date in campaign duplication

Kiran K2e5c08c20b9d
diff --git a/apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts b/apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts
index 226ae9c8a8..22e9448d6d 100644
--- a/apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts
+++ b/apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts
@@ -20,6 +20,7 @@ export const POST = withWorkspace(
},
include: {
workflow: true,
+ groups: true,
},
});
@@ -46,6 +47,7 @@ export const POST = withWorkspace(
},
},
],
+ disabledAt: new Date(),
},
});
@@ -63,6 +65,13 @@ export const POST = withWorkspace(
subject: campaign.subject,
bodyJson: campaign.bodyJson ?? DEFAULT_CAMPAIGN_BODY,
type: campaign.type,
+ groups: {
+ createMany: {
+ data: campaign.groups.map(({ groupId }) => ({
+ groupId,
+ })),
+ },
+ },
},
});
});