Skip to content

Commit

Permalink
Add check is private route (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey-weber authored Jul 23, 2024
1 parent 4d19e7d commit 414f152
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/services/new/workbook/get-workbook-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const getWorkbookContent = async (

const targetTrx = getReplica(trx);

const {user, tenantId} = ctx.get('info');
const {user, tenantId, isPrivateRoute} = ctx.get('info');

const workbook = await getWorkbook(
{ctx, trx, skipValidation: true, skipCheckPermissions},
Expand All @@ -122,7 +122,11 @@ export const getWorkbookContent = async (
const entriesPage = await JoinedEntryRevisionFavorite.findPage({
where: (builder) => {
builder.where({
'entries.tenantId': tenantId,
...(isPrivateRoute
? {}
: {
'entries.tenantId': tenantId,
}),
workbookId: workbookId,
isDeleted: false,
});
Expand Down
2 changes: 1 addition & 1 deletion src/services/new/workbook/get-workbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const getWorkbook = async <T extends WorkbookInstance = WorkbookInstance>
}

logInfo(ctx, 'GET_WORKBOOK_FINISH', {
workbookId: Utils.encodeId(workbook.model.collectionId),
workbookId: Utils.encodeId(workbook.model.workbookId),
});

return workbook as T;
Expand Down

0 comments on commit 414f152

Please sign in to comment.