Make colloboration module not dependant on page module

* add unloadImmediately to collab
This commit is contained in:
Philipinho
2024-04-22 23:40:50 +01:00
parent f65e5c872b
commit 6a57e3edb2
7 changed files with 41 additions and 55 deletions

View File

@ -4,6 +4,7 @@ import { KyselyDB, KyselyTransaction } from '../../types/kysely.types';
import { dbOrTx } from '../../utils';
import {
InsertablePageHistory,
Page,
PageHistory,
UpdatablePageHistory,
} from '@docmost/db/types/entity.types';
@ -64,6 +65,21 @@ export class PageHistoryRepo {
.executeTakeFirst();
}
async saveHistory(page: Page): Promise<void> {
await this.insertPageHistory({
pageId: page.id,
title: page.title,
content: page.content,
slug: page.slug,
icon: page.icon,
version: 1, // TODO: make incremental
coverPhoto: page.coverPhoto,
lastUpdatedById: page.lastUpdatedById ?? page.creatorId,
spaceId: page.spaceId,
workspaceId: page.workspaceId,
});
}
async findPageHistoryByPageId(pageId: string, pagination: PaginationOptions) {
const query = this.db
.selectFrom('pageHistory')