The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update importers to support multiple tags (untested)
Tim Wilson2dba933701d2
diff --git a/apps/web/app/api/cron/import/bitly/utils.ts b/apps/web/app/api/cron/import/bitly/utils.tsindex 9df5440f96..98b8a53bff 100644--- a/apps/web/app/api/cron/import/bitly/utils.ts+++ b/apps/web/app/api/cron/import/bitly/utils.ts@@ -57,7 +57,7 @@ export const importLinksFromBitly = async ({return [];}const createdAt = new Date(created_at).toISOString();- const tagId = tagsToId ? tagsToId[tags[0]] : null;+ const tagIds = tagsToId ? tags.map((tag) => tagsToId[tag]) : [];const linkDetails = {projectId,userId,@@ -67,7 +67,7 @@ export const importLinksFromBitly = async ({title,archived,createdAt,- ...(tagId ? { tagId } : {}),+ tagIds,};return [@@ -160,7 +160,7 @@ export const importLinksFromBitly = async ({prisma.tag.deleteMany({where: {projectId,- links: {+ linksNew: {none: {},},},diff --git a/apps/web/app/api/cron/import/rebrandly/utils.ts b/apps/web/app/api/cron/import/rebrandly/utils.tsindex adeb36631b..b9b964e857 100644--- a/apps/web/app/api/cron/import/rebrandly/utils.ts+++ b/apps/web/app/api/cron/import/rebrandly/utils.ts@@ -139,7 +139,7 @@ export const importLinksFromRebrandly = async ({prisma.tag.deleteMany({where: {projectId,- links: {+ linksNew: {none: {},},},@@ -170,9 +170,9 @@ export const importLinksFromRebrandly = async ({const importedLinks = links.map(({ title, slashtag: key, destination, tags, createdAt, updatedAt }) => {- // if tagsToId is provided and tags array is not empty, get the tagId- const tagId =- tagsToId && tags.length > 0 ? tagsToId[tags[0].name] : null;+ // if tagsToId is provided and tags array is not empty, get the tagIds+ const tagIds =+ tagsToId && tags.length > 0 ? tags.map((tag) => tagsToId[tag]) : [];return {projectId,@@ -183,7 +183,7 @@ export const importLinksFromRebrandly = async ({title,createdAt,updatedAt,- ...(tagId ? { tagId } : {}),+ tagIds,};},)