mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
added date_modified to notes_tree
This commit is contained in:
@@ -20,9 +20,12 @@ router.put('/:noteId/moveTo/:parentId', auth.checkApiAuth, async (req, res, next
|
||||
else
|
||||
newNotePos = maxNotePos + 1;
|
||||
|
||||
const now = utils.nowTimestamp();
|
||||
|
||||
await sql.beginTransaction();
|
||||
|
||||
await sql.execute("update notes_tree set note_pid = ?, note_pos = ? where note_id = ?", [parentId, newNotePos, noteId]);
|
||||
await sql.execute("update notes_tree set note_pid = ?, note_pos = ?, date_modified = ? where note_id = ?",
|
||||
[parentId, newNotePos, now, noteId]);
|
||||
|
||||
await sql.addAudit(audit_category.CHANGE_PARENT, req, noteId);
|
||||
|
||||
@@ -37,12 +40,15 @@ router.put('/:noteId/moveBefore/:beforeNoteId', async (req, res, next) => {
|
||||
|
||||
const beforeNote = await sql.getSingleResult("select * from notes_tree where note_id = ?", [beforeNoteId]);
|
||||
|
||||
if (beforeNote !== null) {
|
||||
if (beforeNote) {
|
||||
const now = utils.nowTimestamp();
|
||||
|
||||
await sql.beginTransaction();
|
||||
|
||||
await sql.execute("update notes_tree set note_pos = note_pos + 1 where note_id = ?", [beforeNoteId]);
|
||||
await sql.execute("update notes_tree set note_pos = note_pos + 1, date_modified = ? where note_id = ?", [now, beforeNoteId]);
|
||||
|
||||
await sql.execute("update notes_tree set note_pid = ?, note_pos = ? where note_id = ?", [beforeNote['note_pid'], beforeNote['note_pos'], noteId]);
|
||||
await sql.execute("update notes_tree set note_pid = ?, note_pos = ?, date_modified = ? where note_id = ?",
|
||||
[beforeNote['note_pid'], beforeNote['note_pos'], now, noteId]);
|
||||
|
||||
await sql.addAudit(audit_category.CHANGE_POSITION, req, noteId);
|
||||
|
||||
@@ -58,12 +64,16 @@ router.put('/:noteId/moveAfter/:afterNoteId', async (req, res, next) => {
|
||||
|
||||
const afterNote = await sql.getSingleResult("select * from notes_tree where note_id = ?", [afterNoteId]);
|
||||
|
||||
if (afterNote !== null) {
|
||||
if (afterNote) {
|
||||
const now = utils.nowTimestamp();
|
||||
|
||||
await sql.beginTransaction();
|
||||
|
||||
await sql.execute("update notes_tree set note_pos = note_pos + 1 where note_pid = ? and note_pos > ?", [afterNote['note_pid'], afterNote['note_pos']]);
|
||||
await sql.execute("update notes_tree set note_pos = note_pos + 1, date_modified = ? where note_pid = ? and note_pos > ?",
|
||||
[now, afterNote['note_pid'], afterNote['note_pos']]);
|
||||
|
||||
await sql.execute("update notes_tree set note_pid = ?, note_pos = ? where note_id = ?", [afterNote['note_pid'], afterNote['note_pos'] + 1, noteId]);
|
||||
await sql.execute("update notes_tree set note_pid = ?, note_pos = ?, date_modified = ? where note_id = ?",
|
||||
[afterNote['note_pid'], afterNote['note_pos'] + 1, now, noteId]);
|
||||
|
||||
await sql.addAudit(audit_category.CHANGE_POSITION, req, noteId);
|
||||
|
||||
@@ -74,10 +84,11 @@ router.put('/:noteId/moveAfter/:afterNoteId', async (req, res, next) => {
|
||||
});
|
||||
|
||||
router.put('/:noteId/expanded/:expanded', async (req, res, next) => {
|
||||
let noteId = req.params.noteId;
|
||||
let expanded = req.params.expanded;
|
||||
const noteId = req.params.noteId;
|
||||
const expanded = req.params.expanded;
|
||||
const now = utils.nowTimestamp();
|
||||
|
||||
await sql.execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, noteId]);
|
||||
await sql.execute("update notes_tree set is_expanded = ?, date_modified = ? where note_id = ?", [expanded, now, noteId]);
|
||||
|
||||
// no audit here, not really important
|
||||
|
||||
|
||||
Reference in New Issue
Block a user