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 update-links

Steven Tey324572710561
diff --git a/apps/web/scripts/testimonial/update-links.ts b/apps/web/scripts/partners/update-links.ts
similarity index 63%
rename from apps/web/scripts/testimonial/update-links.ts
rename to apps/web/scripts/partners/update-links.ts
index 27026157a5..39e89f21c4 100644
--- a/apps/web/scripts/testimonial/update-links.ts
+++ b/apps/web/scripts/partners/update-links.ts
@@ -4,17 +4,20 @@ import { linkCache } from "../../lib/api/links/cache";
import { includeTags } from "../../lib/api/links/include-tags";
import { recordLink } from "../../lib/tinybird";
+const oldDomain = "pinnacle-odds-dropper.link";
+const newDomain = "go.pinnacleoddsdropper.com";
+
// update links
async function main() {
const links = await prisma.link.findMany({
where: {
- domain: "aff.testimonial.to",
+ domain: oldDomain,
key: {
not: "_root",
},
},
include: includeTags,
- take: 500,
+ take: 100,
});
const updatedLinks = await prisma.link.updateMany({
@@ -24,7 +27,7 @@ async function main() {
},
},
data: {
- domain: "refer.testimonial.to",
+ domain: newDomain,
},
});
@@ -35,11 +38,24 @@ async function main() {
recordLink(
links.map((link) => ({
...link,
- domain: "refer.testimonial.to",
+ domain: newDomain,
})),
),
]);
+ await Promise.all(
+ links.map(async (link) => {
+ return await prisma.link.update({
+ where: {
+ id: link.id,
+ },
+ data: {
+ shortLink: link.shortLink.replace(oldDomain, newDomain),
+ },
+ });
+ }),
+ );
+
console.log(res);
}