Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
adding missing .getPojo() to becca entities
zadam84246fd19717
diff --git a/src/services/becca/entities/api_token.js b/src/services/becca/entities/api_token.jsindex e44b31f28c..57ba2ce102 100644--- a/src/services/becca/entities/api_token.js+++ b/src/services/becca/entities/api_token.js@@ -18,6 +18,14 @@ class ApiToken extends AbstractEntity {this.token = row.token;this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();}++ getPojo() {+ return {+ apiTokenId: this.apiTokenId,+ token: this.token,+ utcDateCreated: this.utcDateCreated+ }+ }}module.exports = ApiToken;diff --git a/src/services/becca/entities/note_revision.js b/src/services/becca/entities/note_revision.jsindex 681ac2e75f..4c62b4d17e 100644--- a/src/services/becca/entities/note_revision.js+++ b/src/services/becca/entities/note_revision.js@@ -141,11 +141,24 @@ class NoteRevision extends AbstractEntity {this.utcDateModified = dateUtils.utcNowDateTime();}- // cannot be static!- updatePojo(pojo) {+ getPojo() {+ const pojo = {+ noteRevisionId: this.noteRevisionId,+ noteId: this.noteId,+ type: this.type,+ mime: this.mime,+ isProtected: this.isProtected,+ title: this.title,+ dateLastEdited: this.dateLastEdited,+ dateCreated: this.dateCreated,+ utcDateLastEdited: this.utcDateLastEdited,+ utcDateCreated: this.utcDateCreated,+ utcDateModified: this.utcDateModified+ };+if (pojo.isProtected) {if (protectedSessionService.isProtectedSessionAvailable()) {- pojo.title = protectedSessionService.encrypt(pojo.title);+ pojo.title = protectedSessionService.encrypt(this.title);}else {// updating protected note outside of protected session means we will keep original ciphertexts@@ -153,7 +166,7 @@ class NoteRevision extends AbstractEntity {}}- delete pojo.content;+ return pojo;}}diff --git a/src/services/becca/entities/option.js b/src/services/becca/entities/option.jsindex 78054cf5f8..d535d02ac0 100644--- a/src/services/becca/entities/option.js+++ b/src/services/becca/entities/option.js@@ -26,8 +26,17 @@ class Option extends AbstractEntity {super.beforeSaving();this.utcDateModified = dateUtils.utcNowDateTime();- // utcDateCreated is scheduled for removal so the value does not matter- this.utcDateCreated = dateUtils.utcNowDateTime();+ }++ getPojo() {+ return {+ name: this.name,+ value: this.value,+ isSynced: this.isSynced,+ utcDateModified: this.utcDateModified,+ // utcDateCreated is scheduled for removal so the value does not matter+ utcDateCreated: dateUtils.utcNowDateTime()+ }}}diff --git a/src/services/becca/entities/recent_note.js b/src/services/becca/entities/recent_note.jsindex 9dc2f9aba7..f3765970c6 100644--- a/src/services/becca/entities/recent_note.js+++ b/src/services/becca/entities/recent_note.js@@ -17,6 +17,14 @@ class RecentNote extends AbstractEntity {this.notePath = row.notePath;this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();}++ getPojo() {+ return {+ noteId: this.noteId,+ notePath: this.notePath,+ utcDateCreated: this.utcDateCreated+ }+ }}module.exports = RecentNote;