The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
schema relation rename
Kiran K1d66282d6092
diff --git a/apps/web/app/api/webhooks/[webhookId]/route.ts b/apps/web/app/api/webhooks/[webhookId]/route.tsindex ffe39dc5cc..1da27eb4cd 100644--- a/apps/web/app/api/webhooks/[webhookId]/route.ts+++ b/apps/web/app/api/webhooks/[webhookId]/route.ts@@ -22,7 +22,7 @@ export const GET = withWorkspace(url: true,secret: true,triggers: true,- linkWebhooks: true,+ links: true,},});@@ -94,7 +94,7 @@ export const PATCH = withWorkspace(...(url && { url }),...(triggers && { triggers }),...(linkIds && {- linkWebhooks: {+ links: {deleteMany: {},create: linkIds.map((linkId) => ({linkId,@@ -108,7 +108,7 @@ export const PATCH = withWorkspace(url: true,secret: true,triggers: true,- linkWebhooks: true,+ links: true,},});diff --git a/apps/web/app/api/webhooks/route.ts b/apps/web/app/api/webhooks/route.tsindex 68c0e1c85c..a36869872e 100644--- a/apps/web/app/api/webhooks/route.ts+++ b/apps/web/app/api/webhooks/route.ts@@ -22,7 +22,7 @@ export const GET = withWorkspace(url: true,secret: true,triggers: true,- linkWebhooks: true,+ links: true,},orderBy: {updatedAt: "desc",@@ -93,7 +93,7 @@ export const POST = withWorkspace(triggers,projectId: workspace.id,receiver: "user",- linkWebhooks: {+ links: {...(linkIds &&linkIds.length > 0 && {create: linkIds.map((linkId) => ({@@ -108,7 +108,7 @@ export const POST = withWorkspace(url: true,secret: true,triggers: true,- linkWebhooks: true,+ links: true,},});diff --git a/apps/web/lib/webhook/publish-edge.ts b/apps/web/lib/webhook/publish-edge.tsindex cf22fa1a96..aedd19daed 100644--- a/apps/web/lib/webhook/publish-edge.ts+++ b/apps/web/lib/webhook/publish-edge.ts@@ -25,7 +25,7 @@ export const dispatchWebhook = async (array_contains: [trigger],},...(linkId && {- linkWebhooks: {+ links: {some: {linkId,},diff --git a/apps/web/lib/webhook/publish.ts b/apps/web/lib/webhook/publish.tsindex 3af0240cf0..00a9f59c7d 100644--- a/apps/web/lib/webhook/publish.ts+++ b/apps/web/lib/webhook/publish.ts@@ -25,7 +25,7 @@ export const dispatchWebhook = async (array_contains: [trigger],},...(linkId && {- linkWebhooks: {+ links: {some: {linkId,},diff --git a/apps/web/lib/webhook/utils.ts b/apps/web/lib/webhook/utils.tsindex e45b50d220..cf724bc8de 100644--- a/apps/web/lib/webhook/utils.ts+++ b/apps/web/lib/webhook/utils.ts@@ -4,7 +4,7 @@ import { Webhook } from "@prisma/client";interface TransformWebhookPropsextends Pick<Webhook, "id" | "name" | "url" | "secret" | "triggers"> {- linkWebhooks: { linkId: string }[];+ links: { linkId: string }[];}// Transform webhook@@ -15,7 +15,7 @@ export const transformWebhook = (webhook: TransformWebhookProps) => {url: webhook.url,secret: webhook.secret,triggers: webhook.triggers,- linkIds: webhook.linkWebhooks.map((linkWebhook) => linkWebhook.linkId),+ linkIds: webhook.links.map((link) => link.linkId),};};diff --git a/apps/web/prisma/schema/link.prisma b/apps/web/prisma/schema/link.prismaindex 23cb44b378..fd921135f6 100644--- a/apps/web/prisma/schema/link.prisma+++ b/apps/web/prisma/schema/link.prisma@@ -57,7 +57,7 @@ model Link {tags LinkTag[]// Link webhooks- linkWebhooks LinkWebhook[]+ webhooks LinkWebhook[]// Comments on the particular shortlinkcomments String? @db.LongTextdiff --git a/apps/web/prisma/schema/webhook.prisma b/apps/web/prisma/schema/webhook.prismaindex e88a93aae9..536c6e9638 100644--- a/apps/web/prisma/schema/webhook.prisma+++ b/apps/web/prisma/schema/webhook.prisma@@ -15,8 +15,8 @@ model Webhook {createdAt DateTime @default(now())updatedAt DateTime @updatedAt- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)- linkWebhooks LinkWebhook[]+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ links LinkWebhook[]@@index([projectId])}