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 create-link.ts

Kiran Kac1c411372b5
diff --git a/apps/web/lib/api/links/create-link.ts b/apps/web/lib/api/links/create-link.ts
index efc99c86b5..2326d4e7ed 100644
--- a/apps/web/lib/api/links/create-link.ts
+++ b/apps/web/lib/api/links/create-link.ts
@@ -188,16 +188,8 @@ export async function createLink(link: CreateLinkProps) {
programId: link.programId,
},
},
- select: {
- discount: {
- select: {
- id: true,
- couponId: true,
- couponCodeTrackingEnabledAt: true,
- amount: true,
- type: true,
- },
- },
+ include: {
+ discount: true,
},
});
@@ -261,11 +253,10 @@ export async function createLink(link: CreateLinkProps) {
testVariants && testCompletedAt && scheduleABTestCompletion(response),
- // Create promotion code for the link
+ // Create promotion code for the partner link
!skipCouponCreation &&
- discount?.couponCodeTrackingEnabledAt &&
workspace &&
- link.id &&
+ discount &&
createStripePromotionCode({
workspace,
link: response,
@@ -283,4 +274,4 @@ export async function createLink(link: CreateLinkProps) {
? uploadedImageUrl
: response.image,
};
-}
+}
\ No newline at end of file