The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add tags and short link to link info response
Kiran K8d031e0fa1ed
diff --git a/apps/web/app/api/links/info/route.ts b/apps/web/app/api/links/info/route.tsindex 5139af879a..451f54755d 100644--- a/apps/web/app/api/links/info/route.ts+++ b/apps/web/app/api/links/info/route.ts@@ -28,14 +28,34 @@ export const GET = withAuth(async ({ headers, searchParams }) => {});}+ const tags = await prisma.tag.findMany({+ where: {+ linksNew: {+ some: {+ linkId: link.id,+ },+ },+ },+ select: {+ id: true,+ name: true,+ color: true,+ },+ });++ const shortLink = linkConstructor({+ domain: link.domain,+ key: link.key,+ });+return NextResponse.json({...link,+ shortLink,+ tagId: tags?.[0]?.id ?? null, // backwards compatibility+ tags,+ qrCode: `https://api.dub.co/qr?url=${shortLink}`,workspaceId: `ws_${link.projectId}`,- shortLink: linkConstructor({- domain: link.domain,- key: link.key,- }),},{headers,