From e6183b9a1d2a2bfba5052088463efd55b9331676 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 16 Mar 2023 17:43:37 +0100 Subject: [PATCH] improved saving --- src/becca/entities/battachment.js | 10 ++++------ src/becca/entities/bnote.js | 4 ++-- src/becca/entities/bnote_revision.js | 2 -- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/becca/entities/battachment.js b/src/becca/entities/battachment.js index 5f48761f9..fd82ac9a5 100644 --- a/src/becca/entities/battachment.js +++ b/src/becca/entities/battachment.js @@ -89,20 +89,18 @@ class BAttachment extends AbstractBeccaEntity { return { attachmentId: this.attachmentId, parentId: this.parentId, - name: this.name, + role: this.role, mime: this.mime, + title: this.title, isProtected: !!this.isProtected, - contentCheckSum: this.contentCheckSum, // FIXME isDeleted: false, + utcDateScheduledForDeletionSince: this.utcDateScheduledForDeletionSince, utcDateModified: this.utcDateModified }; } getPojoToSave() { - const pojo = this.getPojo(); - delete pojo.content; // not getting persisted - - return pojo; + return this.getPojo(); } } diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js index 47ec91148..aa1be2577 100644 --- a/src/becca/entities/bnote.js +++ b/src/becca/entities/bnote.js @@ -1408,9 +1408,9 @@ class BNote extends AbstractBeccaEntity { ? this.dateModified : contentMetadata.dateModified, dateCreated: dateUtils.localNowDateTime() - }, true).save(); + }, true); - noteRevision.setContent(content); + noteRevision.setContent(content, { forceSave: true }); return noteRevision; } diff --git a/src/becca/entities/bnote_revision.js b/src/becca/entities/bnote_revision.js index 6457a37da..653069dce 100644 --- a/src/becca/entities/bnote_revision.js +++ b/src/becca/entities/bnote_revision.js @@ -106,14 +106,12 @@ class BNoteRevision extends AbstractBeccaEntity { utcDateLastEdited: this.utcDateLastEdited, utcDateCreated: this.utcDateCreated, utcDateModified: this.utcDateModified, - content: this.content, // used when retrieving full note revision to frontend contentLength: this.contentLength }; } getPojoToSave() { const pojo = this.getPojo(); - delete pojo.content; // not getting persisted delete pojo.contentLength; // not getting persisted if (pojo.isProtected) {