grid view improvements, remembering grid/list status

This commit is contained in:
zadam
2020-10-24 23:50:32 +02:00
parent aeb6c34d27
commit d0efd67d5e
4 changed files with 103 additions and 58 deletions

View File

@@ -62,13 +62,27 @@ function updateNoteAttribute(req) {
attribute.save();
console.log("Saving", attribute);
return {
attributeId: attribute.attributeId
};
}
function setNoteAttribute(req) {
const noteId = req.params.noteId;
const body = req.body;
let attr = repository.getEntity(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = ? AND name = ?`, [noteId, body.type, body.name]);
if (attr) {
attr.value = body.value;
} else {
attr = new Attribute(body);
attr.noteId = noteId;
}
attr.save();
}
function deleteNoteAttribute(req) {
const noteId = req.params.noteId;
const attributeId = req.params.attributeId;
@@ -200,6 +214,7 @@ function deleteRelation(req) {
module.exports = {
updateNoteAttributes,
updateNoteAttribute,
setNoteAttribute,
deleteNoteAttribute,
getAttributeNames,
getValuesForAttribute,