server side WIP - saving encrypted note now works, changing terminology of "encrypted note" to "protected note"

This commit is contained in:
azivner
2017-11-14 21:54:12 -05:00
parent c18799b938
commit ff411f00b1
19 changed files with 208 additions and 87 deletions

View File

@@ -7,15 +7,15 @@ const auth = require('../../services/auth');
router.get('/:noteId', auth.checkApiAuth, async (req, res, next) => {
const noteId = req.params.noteId;
const encryption = req.query.encryption;
const isProtected = req.query.is_protected;
let history;
if (encryption === undefined) {
if (isProtected === undefined) {
history = await sql.getResults("select * from notes_history where note_id = ? order by date_modified_to desc", [noteId]);
}
else {
history = await sql.getResults("select * from notes_history where note_id = ? and encryption = ? order by date_modified_to desc", [noteId, encryption]);
history = await sql.getResults("select * from notes_history where note_id = ? and is_protected = ? order by date_modified_to desc", [noteId, is_protected]);
}
res.send(history);