add back utcDateModified to Attribute and Branch becca entities

This commit is contained in:
zadam 2021-06-26 17:32:40 +02:00
parent 0265c190db
commit 16cc84be99
4 changed files with 10 additions and 5 deletions

View File

@ -29,11 +29,11 @@ function load() {
new Note(row); new Note(row);
} }
for (const row of sql.iterateRows(`SELECT branchId, noteId, parentNoteId, prefix, notePosition, isExpanded FROM branches WHERE isDeleted = 0`, [])) { for (const row of sql.iterateRows(`SELECT branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified FROM branches WHERE isDeleted = 0`, [])) {
new Branch(row); new Branch(row);
} }
for (const row of sql.iterateRows(`SELECT attributeId, noteId, type, name, value, isInheritable, position FROM attributes WHERE isDeleted = 0`, [])) { for (const row of sql.iterateRows(`SELECT attributeId, noteId, type, name, value, isInheritable, position, utcDateModified FROM attributes WHERE isDeleted = 0`, [])) {
new Attribute(row); new Attribute(row);
} }

View File

@ -35,8 +35,7 @@ class AbstractEntity {
} }
getUtcDateChanged() { getUtcDateChanged() {
// FIXME return this.utcDateModified || this.utcDateCreated;
return this.utcDateModified || this.utcDateCreated || "FAKE";
} }
get becca() { get becca() {

View File

@ -28,6 +28,8 @@ class Attribute extends AbstractEntity {
this.value = row.value; this.value = row.value;
/** @param {boolean} */ /** @param {boolean} */
this.isInheritable = !!row.isInheritable; this.isInheritable = !!row.isInheritable;
/** @param {string} */
this.utcDateModified = row.utcDateModified;
if (this.attributeId) { if (this.attributeId) {
this.becca.attributes[this.attributeId] = this; this.becca.attributes[this.attributeId] = this;
@ -136,6 +138,8 @@ class Attribute extends AbstractEntity {
this.isInheritable = false; this.isInheritable = false;
} }
this.utcDateModified = dateUtils.utcNowDateTime();
super.beforeSaving(); super.beforeSaving();
this.becca.attributes[this.attributeId] = this; this.becca.attributes[this.attributeId] = this;
@ -150,7 +154,7 @@ class Attribute extends AbstractEntity {
position: this.position, position: this.position,
value: this.value, value: this.value,
isInheritable: this.isInheritable, isInheritable: this.isInheritable,
utcDateModified: dateUtils.utcNowDateTime(), utcDateModified: this.utcDateModified,
isDeleted: false isDeleted: false
}; };
} }

View File

@ -26,6 +26,8 @@ class Branch extends AbstractEntity {
this.notePosition = row.notePosition; this.notePosition = row.notePosition;
/** @param {boolean} */ /** @param {boolean} */
this.isExpanded = !!row.isExpanded; this.isExpanded = !!row.isExpanded;
/** @param {string} */
this.utcDateModified = row.utcDateModified;
if (this.branchId === 'root') { if (this.branchId === 'root') {
return; return;