From a452e4add5ae6aeded11976bab81f49af965a595 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 28 Jun 2023 21:05:31 +0200 Subject: [PATCH] sync fixes --- src/becca/entities/bblob.js | 4 ++++ src/becca/entities/bnote.js | 2 +- src/becca/entities/brevision.js | 3 ++- src/becca/entity_constructor.js | 22 ++++++++++++---------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/becca/entities/bblob.js b/src/becca/entities/bblob.js index bb8c18616..74395450c 100644 --- a/src/becca/entities/bblob.js +++ b/src/becca/entities/bblob.js @@ -1,4 +1,8 @@ class BBlob { + static get entityName() { return "blobs"; } + static get primaryKeyName() { return "blobId"; } + static get hashedProperties() { return ["blobId", "content"]; } + constructor(row) { /** @type {string} */ this.blobId = row.blobId; diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js index 3090f1737..b54108a7a 100644 --- a/src/becca/entities/bnote.js +++ b/src/becca/entities/bnote.js @@ -25,7 +25,7 @@ const RELATION = 'relation'; class BNote extends AbstractBeccaEntity { static get entityName() { return "notes"; } static get primaryKeyName() { return "noteId"; } - static get hashedProperties() { return ["noteId", "title", "isProtected", "type", "mime"]; } + static get hashedProperties() { return ["noteId", "title", "isProtected", "type", "mime", "blobId"]; } constructor(row) { super(); diff --git a/src/becca/entities/brevision.js b/src/becca/entities/brevision.js index 6433a32cf..8a856713c 100644 --- a/src/becca/entities/brevision.js +++ b/src/becca/entities/brevision.js @@ -17,7 +17,8 @@ const BAttachment = require("./battachment"); class BRevision extends AbstractBeccaEntity { static get entityName() { return "revisions"; } static get primaryKeyName() { return "revisionId"; } - static get hashedProperties() { return ["revisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } + static get hashedProperties() { return ["revisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", + "utcDateLastEdited", "utcDateCreated", "utcDateModified", "blobId"]; } constructor(row, titleDecrypted = false) { super(); diff --git a/src/becca/entity_constructor.js b/src/becca/entity_constructor.js index ea5d934d0..a50301fce 100644 --- a/src/becca/entity_constructor.js +++ b/src/becca/entity_constructor.js @@ -1,21 +1,23 @@ -const BNote = require('./entities/bnote'); -const BRevision = require('./entities/brevision.js'); const BAttachment = require("./entities/battachment"); -const BBranch = require('./entities/bbranch'); const BAttribute = require('./entities/battribute'); -const BRecentNote = require('./entities/brecent_note'); +const BBlob = require("./entities/bblob"); +const BBranch = require('./entities/bbranch'); const BEtapiToken = require('./entities/betapi_token'); +const BNote = require('./entities/bnote'); const BOption = require('./entities/boption'); +const BRecentNote = require('./entities/brecent_note'); +const BRevision = require('./entities/brevision.js'); const ENTITY_NAME_TO_ENTITY = { - "attributes": BAttribute, - "branches": BBranch, - "notes": BNote, - "revisions": BRevision, "attachments": BAttachment, - "recent_notes": BRecentNote, + "attributes": BAttribute, + "blobs": BBlob, + "branches": BBranch, "etapi_tokens": BEtapiToken, - "options": BOption + "notes": BNote, + "options": BOption, + "recent_notes": BRecentNote, + "revisions": BRevision }; function getEntityFromEntityName(entityName) {