check share overview before throwing access error

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-06-24 22:04:37 +02:00
parent 8fe2a290ba
commit f615278189

View File

@@ -159,7 +159,15 @@ export const chartRouter = createTRPCRouter({
userId: ctx.session.userId, userId: ctx.session.userId,
}); });
if (!access) { if (!access) {
throw TRPCAccessError('You do not have access to this project'); const share = await db.shareOverview.findFirst({
where: {
projectId: input.projectId,
},
});
if (!share) {
throw TRPCAccessError('You do not have access to this project');
}
} }
} else { } else {
const share = await db.shareOverview.findFirst({ const share = await db.shareOverview.findFirst({