mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 21:05:55 +01:00
fixes for relation handling + visual design restyled into gray colors
This commit is contained in:
@@ -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
|
||||
};
|
||||
Reference in New Issue
Block a user