Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: team.plan
Marc Seitz6ac61a35e690
diff --git a/pages/api/teams/[teamId]/documents/[id]/versions/index.ts b/pages/api/teams/[teamId]/documents/[id]/versions/index.tsindex d1b7a3ae..03ba4184 100644--- a/pages/api/teams/[teamId]/documents/[id]/versions/index.ts+++ b/pages/api/teams/[teamId]/documents/[id]/versions/index.ts@@ -52,16 +52,21 @@ export default async function handle(const userId = (session.user as CustomUser).id;try {- const teamAccess = await prisma.userTeam.findUnique({+ const team = await prisma.team.findUnique({where: {- userId_teamId: {- userId,- teamId,+ id: teamId,+ users: {+ some: {+ userId,+ },},},+ select: {+ plan: true,+ },});- if (!teamAccess) {+ if (!team) {return res.status(401).end("Unauthorized");}