fix: exclude deleted pages (#1494)

This commit is contained in:
Philip Okugbe
2025-08-31 09:11:33 +01:00
committed by GitHub
parent 08135a2fba
commit aa58e272d6
2 changed files with 4 additions and 2 deletions

View File

@ -399,6 +399,7 @@ export class PageRepo {
]) ])
.$if(opts?.includeContent, (qb) => qb.select('content')) .$if(opts?.includeContent, (qb) => qb.select('content'))
.where('id', '=', parentPageId) .where('id', '=', parentPageId)
.where('deletedAt', 'is', null)
.unionAll((exp) => .unionAll((exp) =>
exp exp
.selectFrom('pages as p') .selectFrom('pages as p')
@ -413,7 +414,8 @@ export class PageRepo {
'p.workspaceId', 'p.workspaceId',
]) ])
.$if(opts?.includeContent, (qb) => qb.select('p.content')) .$if(opts?.includeContent, (qb) => qb.select('p.content'))
.innerJoin('page_hierarchy as ph', 'p.parentPageId', 'ph.id'), .innerJoin('page_hierarchy as ph', 'p.parentPageId', 'ph.id')
.where('p.deletedAt', 'is', null),
), ),
) )
.selectFrom('page_hierarchy') .selectFrom('page_hierarchy')

View File

@ -46,7 +46,7 @@ export class ExportController {
includeContent: true, includeContent: true,
}); });
if (!page) { if (!page || page.deletedAt) {
throw new NotFoundException('Page not found'); throw new NotFoundException('Page not found');
} }