2017-10-22 09:10:33 +08:00
|
|
|
"use strict";
|
|
|
|
|
2017-10-15 11:31:44 +08:00
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
2017-10-16 07:47:05 +08:00
|
|
|
const sql = require('../../services/sql');
|
|
|
|
const auth = require('../../services/auth');
|
2017-10-15 11:31:44 +08:00
|
|
|
|
2017-10-16 04:32:49 +08:00
|
|
|
router.get('/', auth.checkApiAuth, async (req, res, next) => {
|
2017-12-24 00:02:38 +08:00
|
|
|
const recentChanges = await sql.getAll(
|
2017-12-04 06:46:56 +08:00
|
|
|
`SELECT
|
|
|
|
notes.is_deleted AS current_is_deleted,
|
|
|
|
notes.note_title AS current_note_title,
|
|
|
|
notes_history.*
|
|
|
|
FROM
|
|
|
|
notes_history
|
|
|
|
JOIN notes USING(note_id)
|
|
|
|
ORDER BY
|
|
|
|
date_modified_to DESC
|
|
|
|
LIMIT 1000`);
|
2017-10-15 11:31:44 +08:00
|
|
|
|
|
|
|
res.send(recentChanges);
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = router;
|