more becca changes

This commit is contained in:
zadam
2021-04-26 22:24:55 +02:00
parent e466c393eb
commit 219098ab53
5 changed files with 20 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ const log = require('../../services/log');
const attributeService = require('../../services/attributes');
const repository = require('../../services/repository');
const Attribute = require('../../entities/attribute');
const becca = require("../../services/becca/becca.js");
function getEffectiveNoteAttributes(req) {
const note = repository.getNote(req.params.noteId);
@@ -100,15 +101,14 @@ function deleteNoteAttribute(req) {
const noteId = req.params.noteId;
const attributeId = req.params.attributeId;
const attribute = repository.getAttribute(attributeId);
const attribute = becca.getAttribute(attributeId);
if (attribute) {
if (attribute.noteId !== noteId) {
return [400, `Attribute ${attributeId} is not owned by ${noteId}`];
}
attribute.isDeleted = true;
attribute.save();
attribute.markAttributeAsDeleted();
}
}