e52ae65a42
Added some colors to the notes and basic support for displaying the colors on the main list Added a toggle to disable the fancy text editor and just use a basic textarea Added some mobile styles with much better support for smaller screens Added tag suggestions based on user input, excluding tags from current note, only using tags user has put into system Cleaned and refactored a bunch of stuff
39 lines
1000 B
JavaScript
39 lines
1000 B
JavaScript
var express = require('express')
|
|
var router = express.Router()
|
|
|
|
let Tags = require('@models/Tags');
|
|
let userId = null
|
|
|
|
// middleware that is specific to this router
|
|
router.use(function setUserId (req, res, next) {
|
|
if(userId = req.headers.userId){
|
|
userId = req.headers.userId
|
|
}
|
|
|
|
next()
|
|
})
|
|
|
|
//Get the latest notes the user has created
|
|
router.post('/suggest', function (req, res) {
|
|
Tags.suggest(userId, req.body.noteId, req.body.tagText)
|
|
.then( data => res.send(data) )
|
|
})
|
|
|
|
//Get the latest notes the user has created
|
|
router.post('/addtonote', function (req, res) {
|
|
Tags.addToNote(userId, req.body.noteId, req.body.tagText.toLowerCase())
|
|
.then( data => res.send(data) )
|
|
})
|
|
|
|
router.post('/removefromnote', function (req, res) {
|
|
Tags.removeTagFromNote(userId, req.body.tagId)
|
|
.then( data => res.send(data) )
|
|
})
|
|
|
|
//Get the latest notes the user has created
|
|
router.post('/get', function (req, res) {
|
|
Tags.get(userId, req.body.noteId)
|
|
.then( data => res.send(data) )
|
|
})
|
|
|
|
module.exports = router |