The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update transformLink to remove unused properties
Kiran K3e58ea6dec2f
diff --git a/apps/web/app/api/cron/links/[linkId]/complete-tests/route.ts b/apps/web/app/api/cron/links/[linkId]/complete-tests/route.tsindex 9ed34e999e..1a7cda04f8 100644--- a/apps/web/app/api/cron/links/[linkId]/complete-tests/route.ts+++ b/apps/web/app/api/cron/links/[linkId]/complete-tests/route.ts@@ -4,7 +4,7 @@ import { verifyQstashSignature } from "@/lib/cron/verify-qstash";import { prisma } from "@dub/prisma";// POST - /api/cron/links/[linkId]/complete-tests-// Completes a link's tests if they're ready, scheduled by QStash+// Completes a link's AB tests if they're ready, scheduled by QStashexport async function POST(req: Request,{@@ -21,6 +21,9 @@ export async function POST(where: {id: linkId,},+ include: {+ project: true,+ },});if (!link) {diff --git a/apps/web/lib/api/links/complete-ab-tests.ts b/apps/web/lib/api/links/complete-ab-tests.tsindex e286d1096d..5a56fdb025 100644--- a/apps/web/lib/api/links/complete-ab-tests.ts+++ b/apps/web/lib/api/links/complete-ab-tests.ts@@ -31,7 +31,7 @@ export async function completeABTests(link: Link & { project: Project }) {),);- // All results are zero, do nothing+ // There are no leads generated for any test variant, do nothingif (max === 0) {console.log(`AB Test completed but all results are zero for ${link.id}, doing nothing.`,@@ -67,7 +67,6 @@ export async function completeABTests(link: Link & { project: Project }) {? link.expiresAt.toISOString(): link.expiresAt,geo: link.geo as NewLinkProps["geo"],-testVariants: link.testVariants as NewLinkProps["testVariants"],testCompletedAt:link.testCompletedAt instanceof Date@@ -77,9 +76,7 @@ export async function completeABTests(link: Link & { project: Project }) {link.testStartedAt instanceof Date? link.testStartedAt.toISOString(): link.testStartedAt,-url: winner.url,-...(link.key === "_root" && {domain: link.domain,key: link.key,diff --git a/apps/web/lib/api/links/utils/transform-link.ts b/apps/web/lib/api/links/utils/transform-link.tsindex 5c73f546a9..8f0472a9f7 100644--- a/apps/web/lib/api/links/utils/transform-link.ts+++ b/apps/web/lib/api/links/utils/transform-link.ts@@ -23,15 +23,7 @@ export const transformLink = (}// remove webhooks array, dashboard from link- const {- webhooks,- dashboard,- // TODO: Add these back for PR #2173- testCompletedAt,- testStartedAt,- testVariants,- ...rest- } = link;+ const { webhooks, dashboard, ...rest } = link;return {...rest,