continuing in API review

This commit is contained in:
azivner
2018-04-01 20:50:58 -04:00
parent a066c6fe2b
commit c765dbc5cf
9 changed files with 24 additions and 29 deletions

View File

@@ -18,13 +18,13 @@ class Label extends Entity {
this.labelId = utils.newLabelId();
}
if (this.value) {
if (!this.value) {
// null value isn't allowed
this.value = "";
}
if (this.position === undefined) {
this.position = 1 + await sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM labels WHERE noteId = ?`, [noteId]);
this.position = 1 + await sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM labels WHERE noteId = ?`, [this.noteId]);
}
if (!this.isDeleted) {