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 tag_ids = link.tags.map((t) => t.tagId) issue

Steven Tey91dfa63175fa
diff --git a/apps/web/app/api/links/bulk/route.ts b/apps/web/app/api/links/bulk/route.ts
index 00a6fa99e1..d94feeeda4 100644
--- a/apps/web/app/api/links/bulk/route.ts
+++ b/apps/web/app/api/links/bulk/route.ts
@@ -397,11 +397,7 @@ export const DELETE = withWorkspace(
],
},
include: {
- tags: {
- select: {
- id: true,
- },
- },
+ tags: true,
},
});
diff --git a/apps/web/lib/api/links/bulk-delete-links.ts b/apps/web/lib/api/links/bulk-delete-links.ts
index 9929df4fc7..e5521af014 100644
--- a/apps/web/lib/api/links/bulk-delete-links.ts
+++ b/apps/web/lib/api/links/bulk-delete-links.ts
@@ -2,12 +2,12 @@ import { storage } from "@/lib/storage";
import { recordLink } from "@/lib/tinybird";
import { redis } from "@/lib/upstash";
import { R2_URL } from "@dub/utils";
-import { Link, Tag } from "@prisma/client";
+import { Link } from "@prisma/client";
export async function bulkDeleteLinks({
links,
}: {
- links: (Link & { tags: Pick<Tag, "id">[] })[];
+ links: (Link & { tags: { tagId: string }[] })[];
}) {
if (links.length === 0) {
return;
@@ -30,7 +30,7 @@ export async function bulkDeleteLinks({
domain: link.domain,
key: link.key,
url: link.url,
- tag_ids: link.tags.map(({ id }) => id),
+ tag_ids: link.tags.map(({ tagId }) => tagId),
program_id: link.programId ?? "",
workspace_id: link.projectId,
created_at: link.createdAt,
diff --git a/apps/web/scripts/backfill-programId.ts b/apps/web/scripts/backfill-programId.ts
index ae958826fb..dce1985b8e 100644
--- a/apps/web/scripts/backfill-programId.ts
+++ b/apps/web/scripts/backfill-programId.ts
@@ -50,7 +50,7 @@ async function main() {
domain: link.domain,
key: link.key,
url: link.url,
- tag_ids: link.tags.map((t) => t.id) || [],
+ tag_ids: link.tags.map((t) => t.tagId) || [],
program_id: programEnrollment.programId,
workspace_id: link.projectId,
created_at: link.createdAt,