SolidScribe/server/routes/quicknoteController.js
Max G 9c4fff7913 * Removed arrows from notification
* Added trash can function
* Tweaked status text to always be the same
* Removed some open second note code
* Edior always focuses on text now
* Added some extra loading note messages
* Notes are now removed from search index when deleted
* Lots more things happen and update in real time on multiple machines
* Shared notes can be reverted
* WAY more tests
* Note Categories are much more reliable
* Lots of code is much cleaner
2020-05-18 07:45:35 +00:00

38 lines
818 B
JavaScript

var express = require('express')
var router = express.Router()
let QuickNote = require('@models/QuickNote');
let userId = null
let masterKey = null
// middleware that is specific to this router
router.use(function setUserId (req, res, next) {
if(userId = req.headers.userId){
userId = req.headers.userId
masterKey = req.headers.masterKey
}
next()
})
//Get quick note text
router.post('/get', function (req, res) {
QuickNote.get(userId, masterKey)
.then( data => res.send(data) )
})
//Push text to quick note
router.post('/update', function (req, res) {
QuickNote.update(userId, req.body.pushText, masterKey)
.then( data => res.send(data) )
})
//Push text to quick note
router.post('/new', function (req, res) {
QuickNote.newNote(userId)
.then( data => res.send(data) )
})
module.exports = router