From 37c30bf88a07a1aaa94cb3ebf5185968c51fdb9c Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 29 Sep 2021 13:33:05 +0200 Subject: [PATCH] fix initializing new attribute in becca --- src/routes/api/attributes.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes/api/attributes.js b/src/routes/api/attributes.js index 9eb01ceb3..660ef2be4 100644 --- a/src/routes/api/attributes.js +++ b/src/routes/api/attributes.js @@ -80,9 +80,10 @@ function setNoteAttribute(req) { attr.value = body.value; attr.save(); } else { - const attr = new Attribute(body); - attr.noteId = noteId; - attr.save(); + const params = {...body}; + params.noteId = noteId; // noteId must be set before calling constructor for proper initialization + + new Attribute(params).save(); } }