Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: missing links type

Marc Seitz189f69e6a5a7
diff --git a/lib/team/helper.ts b/lib/team/helper.ts
index fee5cc33..7edcb33a 100644
--- a/lib/team/helper.ts
+++ b/lib/team/helper.ts
@@ -1,6 +1,6 @@
import prisma from "@/lib/prisma";
import { DocumentError, TeamError } from "../errorHandler";
-import { Document, DocumentVersion, Domain, View } from "@prisma/client";
+import { Document, DocumentVersion, Domain, Link, View } from "@prisma/client";
interface ITeamUserAndDocument {
teamId: string;
@@ -59,7 +59,7 @@ export async function getTeamWithUsersAndDocument({
// check if the document exists in the team
let document:
- | (Document & { views?: View[]; versions?: DocumentVersion[] })
+ | (Document & { views?: View[]; versions?: DocumentVersion[]; links?: Link[] })
| undefined;
if (docId) {
document = team?.documents.find((doc) => doc.id === docId);
diff --git a/pages/api/teams/[teamId]/documents/[id]/links.ts b/pages/api/teams/[teamId]/documents/[id]/links.ts
index fc9b307a..6987ca78 100644
--- a/pages/api/teams/[teamId]/documents/[id]/links.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/links.ts
@@ -51,7 +51,7 @@ export default async function handle(
},
});
- const links = document.links;
+ const links = document!.links;
return res.status(200).json(links);
} catch (error) {
log(`Failed to get links for document ${docId}. Error: \n\n ${error}`);