* integrate websocket redis adapter
* use APP_SECRET for jwt signing
* auto migrate database on startup in production
* add updatedAt to update db operations
* create enterprise ee package directory
* fix comment editor focus
* other fixes
This commit is contained in:
Philipinho
2024-06-07 17:29:34 +01:00
parent eef9081aaf
commit 38ef610e5e
36 changed files with 541 additions and 166 deletions
@@ -46,9 +46,13 @@ export class PageRepo {
includeContent?: boolean;
includeYdoc?: boolean;
includeSpace?: boolean;
withLock?: boolean;
trx?: KyselyTransaction;
},
): Promise<Page> {
let query = this.db
const db = dbOrTx(this.db, opts?.trx);
let query = db
.selectFrom('pages')
.select(this.baseFields)
.$if(opts?.includeContent, (qb) => qb.select('content'))
@@ -58,6 +62,10 @@ export class PageRepo {
query = query.select((eb) => this.withSpace(eb));
}
if (opts?.withLock && opts?.trx) {
query = query.forUpdate();
}
if (isValidUUID(pageId)) {
query = query.where('id', '=', pageId);
} else {
@@ -73,7 +81,9 @@ export class PageRepo {
trx?: KyselyTransaction,
) {
const db = dbOrTx(this.db, trx);
let query = db.updateTable('pages').set(updatablePage);
let query = db
.updateTable('pages')
.set({ ...updatablePage, updatedAt: new Date() });
if (isValidUUID(pageId)) {
query = query.where('id', '=', pageId);