mirror of
https://github.com/zadam/trilium.git
synced 2025-02-23 06:26:31 +08:00
adding missing .getPojo() to becca entities
This commit is contained in:
parent
9441cb177f
commit
84246fd197
4 changed files with 44 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue