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');
|
2018-01-07 22:35:44 +08:00
|
|
|
const wrap = require('express-promise-wrap').wrap;
|
2017-10-15 11:31:44 +08:00
|
|
|
|
2018-01-07 22:35:44 +08:00
|
|
|
router.get('/', auth.checkApiAuth, wrap(async (req, res, next) => {
|
2018-01-30 06:41:59 +08:00
|
|
|
const recentChanges = await sql.getRows(
|
2017-12-04 06:46:56 +08:00
|
|
|
`SELECT
|
2018-01-29 08:30:14 +08:00
|
|
|
notes.isDeleted AS current_isDeleted,
|
|
|
|
notes.title AS current_title,
|
2018-01-29 08:38:05 +08:00
|
|
|
note_revisions.*
|
2017-12-04 06:46:56 +08:00
|
|
|
FROM
|
2018-01-29 08:38:05 +08:00
|
|
|
note_revisions
|
2018-01-29 08:30:14 +08:00
|
|
|
JOIN notes USING(noteId)
|
2017-12-04 06:46:56 +08:00
|
|
|
ORDER BY
|
2018-01-29 08:30:14 +08:00
|
|
|
dateModifiedTo DESC
|
2017-12-04 06:46:56 +08:00
|
|
|
LIMIT 1000`);
|
2017-10-15 11:31:44 +08:00
|
|
|
|
|
|
|
res.send(recentChanges);
|
2018-01-07 22:35:44 +08:00
|
|
|
}));
|
2017-10-15 11:31:44 +08:00
|
|
|
|
|
|
|
module.exports = router;
|