feat: move page between spaces (#988)

* feat: Move the page to another space

- The ability to move a page to another space has been added

* feat: Move the page to another space
* feat: Move the page to another space

- Correction of the visibility attribute of elements that extend beyond the boundaries of the space selection modal window

* feat: Move the page to another space

- Added removal of query keys when moving pages

* feat: Move the page to another space

- Fix locales

* feat: Move the page to another space
* feat: Move the page to another space

- Fix docker compose

* feat: Move the page to another space

* feat: Move the page to another space

- Some refactor

* feat: Move the page to another space

- Attachments update

* feat: Move the page to another space

- The function of searching for attachments by page ID and updating attachments has been combined

* feat: Move the page to another space

- Fix variable name

* feat: Move the page to another space

- Move current space to parameter of component SpaceSelectionModal

* refactor ui

---------

Co-authored-by: plekhanov <astecom@mail.ru>
This commit is contained in:
Philip Okugbe
2025-04-04 23:44:18 +01:00
committed by GitHub
parent b27d1708b0
commit 17ce3bab8a
15 changed files with 316 additions and 49 deletions

View File

@ -55,6 +55,18 @@ export class AttachmentRepo {
.execute();
}
updateAttachmentsByPageId(
updatableAttachment: UpdatableAttachment,
pageIds: string[],
trx?: KyselyTransaction,
) {
return dbOrTx(this.db, trx)
.updateTable('attachments')
.set(updatableAttachment)
.where('pageId', 'in', pageIds)
.executeTakeFirst();
}
async updateAttachment(
updatableAttachment: UpdatableAttachment,
attachmentId: string,

View File

@ -96,18 +96,19 @@ export class PageRepo {
pageId: string,
trx?: KyselyTransaction,
) {
const db = dbOrTx(this.db, trx);
let query = db
return this.updatePages(updatablePage, [pageId], trx);
}
async updatePages(
updatePageData: UpdatablePage,
pageIds: string[],
trx?: KyselyTransaction,
) {
return dbOrTx(this.db, trx)
.updateTable('pages')
.set({ ...updatablePage, updatedAt: new Date() });
if (isValidUUID(pageId)) {
query = query.where('id', '=', pageId);
} else {
query = query.where('slugId', '=', pageId);
}
return query.executeTakeFirst();
.set({ ...updatePageData, updatedAt: new Date() })
.where(pageIds.some(pageId => !isValidUUID(pageId)) ? "slugId" : "id", "in", pageIds)
.executeTakeFirst();
}
async insertPage(