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 bulk-create-links.ts

Steven Tey0c6c867f7740
diff --git a/apps/web/lib/api/links/bulk-create-links.ts b/apps/web/lib/api/links/bulk-create-links.ts
index 2d9467ae35..ed186cf806 100644
--- a/apps/web/lib/api/links/bulk-create-links.ts
+++ b/apps/web/lib/api/links/bulk-create-links.ts
@@ -26,15 +26,14 @@ export async function bulkCreateLinks({
// @see https://www.prisma.io/docs/orm/reference/prisma-client-reference#createmanyandreturn
createdLinks = await Promise.all(
links.map(({ tagId, tagIds, tagNames, ...link }) => {
- const { utm_source, utm_medium, utm_campaign, utm_term, utm_content } =
- getParamsFromURL(link.url);
-
- const combinedTagIds = combineTagIds({ tagId, tagIds });
-
const shortLink = linkConstructor({
domain: link.domain,
key: link.key,
});
+ const { utm_source, utm_medium, utm_campaign, utm_term, utm_content } =
+ getParamsFromURL(link.url);
+
+ const combinedTagIds = combineTagIds({ tagId, tagIds });
return prisma.link.create({
data: {
@@ -98,8 +97,7 @@ export async function bulkCreateLinks({
);
} else {
// if there are no tags, we can use createMany to create the links
- console.time("createMany");
- const res = await prisma.link.createMany({
+ await prisma.link.createMany({
data: links.map((link) => {
const shortLink = linkConstructor({
domain: link.domain,
@@ -124,8 +122,6 @@ export async function bulkCreateLinks({
}),
});
- console.timeEnd("createMany");
-
createdLinks = await prisma.link.findMany({
where: {
shortLink: {