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.

Merge branch 'main' into tim/multiple-tags-cleanup

Steven Tey5b406114842d
diff --cc apps/web/lib/api/links/create-link.ts
index af0d7cb784,6d246cf05a..f9108e38a3
--- a/apps/web/lib/api/links/create-link.ts
+++ b/apps/web/lib/api/links/create-link.ts
@@@ -6,9 -6,9 +6,9 @@@ import { ProcessedLinkProps } from "@/l
import { formatRedisLink, redis } from "@/lib/upstash";
import { APP_DOMAIN_WITH_NGROK, getParamsFromURL, truncate } from "@dub/utils";
import { Prisma } from "@prisma/client";
- import { combineTagIds, dubLinkChecks, transformLink } from "./utils";
+ import { combineTagIds, transformLink } from "./utils";
-export async function createLink(link: LinkWithTagIdsProps) {
+export async function createLink(link: ProcessedLinkProps) {
let { key, url, expiresAt, title, description, image, proxy, geo } = link;
const combinedTagIds = combineTagIds(link);
diff --cc apps/web/lib/api/links/process-link.ts
index f7b0a38732,0af70ab19e..ce5ae07625
--- a/apps/web/lib/api/links/process-link.ts
+++ b/apps/web/lib/api/links/process-link.ts
@@@ -1,7 -1,8 +1,8 @@@
- import { isBlacklistedDomain } from "@/lib/edge-config";
- import { getRandomKey } from "@/lib/planetscale";
+ import { isBlacklistedDomain, updateConfig } from "@/lib/edge-config";
+ import { getPangeaDomainIntel } from "@/lib/pangea";
+ import { checkIfUserExists, getRandomKey } from "@/lib/planetscale";
import prisma from "@/lib/prisma";
-import { LinkWithTagIdsProps, WorkspaceProps } from "@/lib/types";
+import { NewLinkProps, ProcessedLinkProps, WorkspaceProps } from "@/lib/types";
import {
DUB_DOMAINS,
SHORT_DOMAIN,
diff --cc apps/web/lib/api/links/utils.ts
index 37dc4bcc5c,4e94d3cc65..3b736ad0a6
--- a/apps/web/lib/api/links/utils.ts
+++ b/apps/web/lib/api/links/utils.ts
@@@ -1,18 -1,11 +1,15 @@@
-import { isReservedKey, isReservedUsername } from "@/lib/edge-config";
+import {
+ isBlacklistedKey,
+ isReservedKey,
+ isReservedUsername,
+} from "@/lib/edge-config";
import { checkIfKeyExists } from "@/lib/planetscale";
- import { SimpleLinkProps, WorkspaceProps } from "@/lib/types";
+ import { WorkspaceProps } from "@/lib/types";
import {
DEFAULT_REDIRECTS,
- GOOGLE_FAVICON_URL,
SHORT_DOMAIN,
- getApexDomain,
isDubDomain,
linkConstructor,
- log,
punyEncode,
validKeyRegex,
} from "@dub/utils";
diff --cc apps/web/lib/zod/schemas/links.ts
index bfe566ae69,f5cd64b729..fb122a177d
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@@ -158,14 -155,8 +162,15 @@@ export const createLinkBodySchema = z.o
.union([z.string(), z.array(z.string())])
.transform((v) => (Array.isArray(v) ? v : v.split(",")))
.optional()
- .describe("The unique IDs of the tags assigned to the short link."),
+ .describe("The unique IDs of the tags assigned to the short link.")
+ .openapi({ example: ["clux0rgak00011..."] }),
+ tagNames: z
+ .union([z.string(), z.array(z.string())])
+ .transform((v) => (Array.isArray(v) ? v : v.split(",")))
+ .optional()
+ .describe(
+ "The unique name of the tags assigned to the short link (case insensitive).",
+ ),
comments: z.string().nullish().describe("The comments for the short link."),
expiresAt: z
.string()
diff --cc apps/web/prisma/schema.prisma
index 6e95c1ada3,ab300ddc85..38178bb258
--- a/apps/web/prisma/schema.prisma
+++ b/apps/web/prisma/schema.prisma
@@@ -269,14 -276,15 +271,14 @@@ model Link
}
model Tag {
- id String @id @default(cuid())
+ id String @id @default(cuid())
name String
- color String @default("blue")
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+ color String @default("blue")
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
projectId String
- links Link[]
- linksNew LinkTag[]
+ links LinkTag[]
@@unique([name, projectId])
@@index(projectId)