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 execute-send-campaign-workflow.ts

Kiran K5651a7bc44bd
diff --git a/apps/web/lib/api/workflows/execute-send-campaign-workflow.ts b/apps/web/lib/api/workflows/execute-send-campaign-workflow.ts
index 91dc597bbc..5a269f49cb 100644
--- a/apps/web/lib/api/workflows/execute-send-campaign-workflow.ts
+++ b/apps/web/lib/api/workflows/execute-send-campaign-workflow.ts
@@ -215,25 +215,6 @@ export const executeSendCampaignWorkflow = async ({
}
};
-const enrollmentLinksForEmail = {
- select: { shortLink: true, key: true, url: true },
- orderBy: { id: "asc" as const },
-};
-
-const enrollmentLinksForWorkflowStats = {
- select: {
- shortLink: true,
- key: true,
- url: true,
- clicks: true,
- leads: true,
- conversions: true,
- sales: true,
- saleAmount: true,
- },
- orderBy: { id: "asc" as const },
-};
-
const includePartnerUsers = {
partner: {
include: {
@@ -244,8 +225,21 @@ const includePartnerUsers = {
},
},
},
- partnerGroup: { select: { linkStructure: true } },
- links: enrollmentLinksForEmail,
+ partnerGroup: {
+ select: {
+ linkStructure: true,
+ },
+ },
+ links: {
+ select: {
+ shortLink: true,
+ key: true,
+ url: true,
+ },
+ orderBy: {
+ id: "asc" as const,
+ },
+ },
} satisfies Prisma.ProgramEnrollmentInclude;
async function getProgramEnrollments({
@@ -284,7 +278,23 @@ async function getProgramEnrollments({
include: {
...includePartnerUsers,
...(isPartnerLinkStatsAttribute
- ? { links: enrollmentLinksForWorkflowStats }
+ ? {
+ links: {
+ select: {
+ shortLink: true,
+ key: true,
+ url: true,
+ clicks: true,
+ leads: true,
+ conversions: true,
+ sales: true,
+ saleAmount: true,
+ },
+ orderBy: {
+ id: "asc",
+ },
+ },
+ }
: {}),
},
});