Tweaked display of note cards, again

* Added an option to pin notes, on the main screen
This commit is contained in:
Max G
2020-03-02 05:33:49 +00:00
parent 2d0beec409
commit de3391eb94
6 changed files with 96 additions and 12 deletions

View File

@@ -202,6 +202,21 @@ Note.update = (io, userId, noteId, noteText, color, pinned, archived) => {
})
}
Note.setPinned = (userId, noteId, pinnedBoolean) => {
return new Promise((resolve, reject) => {
const pinned = pinnedBoolean ? 1:0
//Update other note attributes
return db.promise()
.query('UPDATE note SET pinned = ? WHERE id = ? AND user_id = ? LIMIT 1',
[pinned, noteId, userId])
.then((rows, fields) => {
resolve(true)
})
})
}
//
// Delete a note and all its remaining parts
//

View File

@@ -62,6 +62,16 @@ router.post('/difftext', function (req, res) {
})
})
//
// Update single note attributes
//
router.post('/setpinned', function (req, res) {
Notes.setPinned(userId, req.body.noteId, req.body.pinned)
.then( results => {
res.send(results)
})
})
//
// Share Note Actions
//