This commit is contained in:
zadam
2020-01-30 22:38:31 +01:00
parent 48b401164a
commit 8bf794f13b
6 changed files with 67 additions and 41 deletions

View File

@@ -5,7 +5,13 @@ export class LoadResults {
this.noteIdToSourceId = {};
this.sourceIdToNoteIds = {};
this.branchIdToSourceId = {};
this.branches = [];
this.attributes = [];
this.noteReorderings = [];
this.noteRevisions = [];
}
addNote(noteId, sourceId) {
@@ -23,36 +29,39 @@ export class LoadResults {
}
addBranch(branchId, sourceId) {
this.branchIdToSourceId[branchId] = this.branchIdToSourceId[branchId] || [];
this.branchIdToSourceId[branchId].push(sourceId);
this.branches.push({branchId, sourceId});
}
getBranches() {
return this.branches
.map(row => this.treeCache.branches[row.branchId])
.filter(branch => !!branch);
}
addNoteReordering(parentNoteId, sourceId) {
this.noteReorderings.push(parentNoteId);
}
getNoteReorderings() {
return this.noteReorderings;
}
addAttribute(attributeId, sourceId) {
this.attributes.push({attributeId, sourceId});
}
getAttributes() {
return this.attributes
.map(row => this.treeCache.attributes[row.attributeId])
.filter(attr => !!attr);
}
addNoteRevision(noteRevisionId, noteId, sourceId) {
this.noteRevisions.push({noteRevisionId, noteId, sourceId});
}
hasNoteRevisionForNote(noteId) {
return !!this.noteRevisions.find(nr => nr.noteId === noteId);
}
getNoteIds() {