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.

minor fixes

Steven Tey927b9cd67e95
diff --git a/apps/web/lib/api/links/bulk-create-links.ts b/apps/web/lib/api/links/bulk-create-links.ts
index 4917dcceeb..f275ce836c 100644
--- a/apps/web/lib/api/links/bulk-create-links.ts
+++ b/apps/web/lib/api/links/bulk-create-links.ts
@@ -15,7 +15,7 @@ export async function bulkCreateLinks({
// create links via Promise.all (because Prisma doesn't support nested createMany)
// ref: https://github.com/prisma/prisma/issues/8131#issuecomment-997667070
- const createdLinks = await prisma.$transaction(
+ const createdLinks = await Promise.all(
links.map(({ tagId, tagIds, tagNames, ...link }) => {
const { utm_source, utm_medium, utm_campaign, utm_term, utm_content } =
getParamsFromURL(link.url);
diff --git a/apps/web/lib/zod/schemas/domains.ts b/apps/web/lib/zod/schemas/domains.ts
index ba1cb20e95..37d8c8b080 100644
--- a/apps/web/lib/zod/schemas/domains.ts
+++ b/apps/web/lib/zod/schemas/domains.ts
@@ -75,6 +75,7 @@ export const createDomainBodySchema = z.object({
slug: z
.string({ required_error: "slug is required" })
.min(1, "slug cannot be empty.")
+ .max(190, "slug cannot be longer than 190 characters.")
.describe("Name of the domain.")
.openapi({ example: "acme.com" }),
expiredUrl: parseUrlSchemaAllowEmpty
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index cd96138a5a..953f045ac6 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -139,12 +139,14 @@ export const createLinkBodySchema = z.object({
}),
domain: z
.string()
+ .max(190)
.optional()
.describe(
"The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains).",
),
key: z
.string()
+ .max(190)
.optional()
.describe(
"The short link slug. If not provided, a random 7-character slug will be generated.",
diff --git a/apps/web/prisma/schema/link.prisma b/apps/web/prisma/schema/link.prisma
index 475d682658..85fbe716de 100644
--- a/apps/web/prisma/schema/link.prisma
+++ b/apps/web/prisma/schema/link.prisma
@@ -3,7 +3,7 @@ model Link {
domain String // domain of the link (e.g. dub.sh) – also stored on Redis
key String // key of the link (e.g. /github) – also stored on Redis
url String @db.LongText // target url (e.g. https://github.com/dubinc/dub) – also stored on Redis
- shortLink String? @unique // new column for the full short link
+ shortLink String? @unique @db.VarChar(400) // new column for the full short link
archived Boolean @default(false) // whether the link is archived or not
expiresAt DateTime? // when the link expires – stored on Redis via ttl
expiredUrl String? @db.LongText // URL to redirect the user to when the link is expired