Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
simplify prisma create requests
Marc Seitz14bf3385c6e4
diff --git a/pages/api/documents/index.ts b/pages/api/documents/index.tsindex 3d865f27..91b56f9a 100644--- a/pages/api/documents/index.ts+++ b/pages/api/documents/index.ts@@ -67,17 +67,16 @@ export default async function handle(file: url,type: type,ownerId: (session.user as CustomUser).id,+ links : {+ create: {}+ }},- });-- const link = await prisma.link.create({- data: {- documentId: document.id,- // url: nanoid(),+ include: {+ links: true,},});- res.status(201).json({ document, linkId: link.id });+ res.status(201).json(document);} catch (error) {res.status(500).json({message: "Internal Server Error",diff --git a/pages/documents/new.tsx b/pages/documents/new.tsxindex dfa5c6f7..f39d6a74 100644--- a/pages/documents/new.tsx+++ b/pages/documents/new.tsx@@ -55,10 +55,10 @@ export default function Form() {throw new Error(`HTTP error! status: ${response.status}`);}- const { document, linkId } = await response.json();+ const document = await response.json();navigator.clipboard.writeText(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${linkId}`+ `${process.env.NEXT_PUBLIC_BASE_URL}/view/${document.links[0].id}`);toast.custom((t) => (