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.

Fix types

Tim Wilson6c7361719ef1
diff --git a/apps/web/app/api/links/bulk/route.ts b/apps/web/app/api/links/bulk/route.ts
index e6d7b1e337..1349876884 100644
--- a/apps/web/app/api/links/bulk/route.ts
+++ b/apps/web/app/api/links/bulk/route.ts
@@ -389,6 +389,11 @@ export const PATCH = withWorkspace(
? link.expiresAt.toISOString()
: link.expiresAt,
geo: link.geo as NewLinkProps["geo"],
+ tests: link.tests as NewLinkProps["tests"],
+ testsCompleteAt:
+ link.testsCompleteAt instanceof Date
+ ? link.testsCompleteAt.toISOString()
+ : link.testsCompleteAt,
...data,
},
workspace,
diff --git a/apps/web/app/api/links/upsert/route.ts b/apps/web/app/api/links/upsert/route.ts
index 19d102083f..57ec39214b 100644
--- a/apps/web/app/api/links/upsert/route.ts
+++ b/apps/web/app/api/links/upsert/route.ts
@@ -62,6 +62,11 @@ export const PUT = withWorkspace(
? link.expiresAt.toISOString()
: link.expiresAt,
geo: link.geo as NewLinkProps["geo"],
+ tests: link.tests as NewLinkProps["tests"],
+ testsCompleteAt:
+ link.testsCompleteAt instanceof Date
+ ? link.testsCompleteAt.toISOString()
+ : link.testsCompleteAt,
...body,
};
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/links/[linkId]/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
index c06c389da8..f707760263 100644
--- a/apps/web/app/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
+++ b/apps/web/app/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
@@ -62,6 +62,11 @@ export const PATCH = withPartnerProfile(
? link.expiresAt.toISOString()
: link.expiresAt,
geo: link.geo as NewLinkProps["geo"],
+ tests: link.tests as NewLinkProps["tests"],
+ testsCompleteAt:
+ link.testsCompleteAt instanceof Date
+ ? link.testsCompleteAt.toISOString()
+ : link.testsCompleteAt,
// merge in new props
key: key || undefined,
diff --git a/apps/web/app/api/partners/links/upsert/route.ts b/apps/web/app/api/partners/links/upsert/route.ts
index c5ff12ecd6..8f0d325353 100644
--- a/apps/web/app/api/partners/links/upsert/route.ts
+++ b/apps/web/app/api/partners/links/upsert/route.ts
@@ -85,6 +85,11 @@ export const PUT = withWorkspace(
? link.expiresAt.toISOString()
: link.expiresAt,
geo: link.geo as NewLinkProps["geo"],
+ tests: link.tests as NewLinkProps["tests"],
+ testsCompleteAt:
+ link.testsCompleteAt instanceof Date
+ ? link.testsCompleteAt.toISOString()
+ : link.testsCompleteAt,
// merge in new props
...linkProps,
// set default fields
diff --git a/apps/web/lib/api/links/complete-tests.ts b/apps/web/lib/api/links/complete-tests.ts
index 1fca7d5675..c9520010d1 100644
--- a/apps/web/lib/api/links/complete-tests.ts
+++ b/apps/web/lib/api/links/complete-tests.ts
@@ -67,7 +67,10 @@ export async function completeTests(link: Link & { project: Project }) {
geo: link.geo as NewLinkProps["geo"],
tests: link.tests as NewLinkProps["tests"],
- testsCompleteAt: new Date(link.testsCompleteAt).toISOString(),
+ testsCompleteAt:
+ link.testsCompleteAt instanceof Date
+ ? link.testsCompleteAt.toISOString()
+ : link.testsCompleteAt,
// Update URL
url: winner.url,