changes in backend script running

This commit is contained in:
azivner
2018-03-03 09:11:41 -05:00
parent 982b723647
commit d169f67901
5 changed files with 54 additions and 58 deletions

View File

@@ -32,6 +32,17 @@ class Note extends Entity {
return this.repository.getEntities("SELECT * FROM attributes WHERE noteId = ? AND isDeleted = 0", [this.noteId]);
}
// WARNING: this doesn't take into account the possibility to have multi-valued attributes!
async getAttributeMap() {
const map = {};
for (const attr of await this.getAttributes()) {
map[attr.name] = attr.value;
}
return map;
}
async getAttribute(name) {
return this.repository.getEntity("SELECT * FROM attributes WHERE noteId = ? AND name = ?", [this.noteId, name]);
}