feat: space export (#506)

* wip

* Space export
* option to export pages with children
* include attachments in exports
* unified export UI

* cleanup

* fix: change export icon

* add export button to space settings

* cleanups

* export name
This commit is contained in:
Philip Okugbe
2024-11-30 19:47:22 +00:00
committed by GitHub
parent 9fa432dba9
commit fe83557767
20 changed files with 926 additions and 117 deletions

View File

@ -160,4 +160,30 @@ export class PageRepo {
.whereRef('spaces.id', '=', 'pages.spaceId'),
).as('space');
}
async getPageAndDescendants(parentPageId: string) {
return this.db
.withRecursive('page_hierarchy', (db) =>
db
.selectFrom('pages')
.select(['id', 'slugId', 'title', 'icon', 'content', 'parentPageId'])
.where('id', '=', parentPageId)
.unionAll((exp) =>
exp
.selectFrom('pages as p')
.select([
'p.id',
'p.slugId',
'p.title',
'p.icon',
'p.content',
'p.parentPageId',
])
.innerJoin('page_hierarchy as ph', 'p.parentPageId', 'ph.id'),
),
)
.selectFrom('page_hierarchy')
.selectAll()
.execute();
}
}