Link entity migrated to Attribute, WIP

This commit is contained in:
zadam
2019-08-19 20:12:00 +02:00
parent fd9b79e115
commit 3cb421143f
22 changed files with 172 additions and 174 deletions

View File

@@ -1,4 +1,6 @@
import server from '../services/server.js';
import Attribute from './attribute.js';
import Link from './link.js';
const LABEL = 'label';
const LABEL_DEFINITION = 'label-definition';
@@ -84,7 +86,8 @@ class NoteShort {
*/
async getAttributes(name) {
if (!this.attributeCache) {
this.attributeCache = await server.get('notes/' + this.noteId + '/attributes');
this.attributeCache = (await server.get('notes/' + this.noteId + '/attributes'))
.map(attrRow => new Attribute(this.treeCache, attrRow));
}
if (name) {
@@ -227,6 +230,14 @@ class NoteShort {
this.attributeCache = null;
}
/**
* @return {Promise<Link[]>}
*/
async getLinks() {
return (await server.get('notes/' + this.noteId + '/links'))
.map(linkRow => new Link(this.treeCache, linkRow));
}
get toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`;
}