check share overview before throwing access error
This commit is contained in:
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user