Tweaked display of note cards, again
* Added an option to pin notes, on the main screen
This commit is contained in:
@@ -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
|
||||
//
|
||||
|
@@ -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
|
||||
//
|
||||
|
Reference in New Issue
Block a user