fixes for relation handling + visual design restyled into gray colors

This commit is contained in:
azivner
2018-10-30 10:36:19 +01:00
parent a19af8a61d
commit 2a14ea8d0c
5 changed files with 53 additions and 54 deletions

View File

@@ -123,8 +123,31 @@ async function createRelation(req) {
await attribute.save();
}
return attribute;
}
async function deleteRelation(req) {
const sourceNoteId = req.params.noteId;
const targetNoteId = req.params.targetNoteId;
const name = req.params.name;
let attribute = await repository.getEntity(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
if (!attribute) {
attribute = new Attribute();
attribute.noteId = sourceNoteId;
attribute.name = name;
attribute.type = 'relation';
attribute.value = targetNoteId;
await attribute.save();
}
return attribute;
}
module.exports = {
updateNoteAttributes,
updateNoteAttribute,
@@ -132,5 +155,6 @@ module.exports = {
getAttributeNames,
getValuesForAttribute,
getEffectiveNoteAttributes,
createRelation
createRelation,
deleteRelation
};