mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	converted settings, note revisions, password change and recent changes routes
This commit is contained in:
		| @@ -1,31 +1,16 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const express = require('express'); | ||||
| const router = express.Router(); | ||||
| const sql = require('../../services/sql'); | ||||
| const auth = require('../../services/auth'); | ||||
| const protected_session = require('../../services/protected_session'); | ||||
| const sync_table = require('../../services/sync_table'); | ||||
| const wrap = require('express-promise-wrap').wrap; | ||||
|  | ||||
| router.get('/:noteId', auth.checkApiAuth, wrap(async (req, res, next) => { | ||||
| async function getNoteRevisions(req) { | ||||
|     const noteId = req.params.noteId; | ||||
|     const revisions = await sql.getRows("SELECT * FROM note_revisions WHERE noteId = ? order by dateModifiedTo desc", [noteId]); | ||||
|     protected_session.decryptNoteRevisions(req, revisions); | ||||
|  | ||||
|     res.send(revisions); | ||||
| })); | ||||
|     return revisions; | ||||
| } | ||||
|  | ||||
| router.put('', auth.checkApiAuth, wrap(async (req, res, next) => { | ||||
|     const sourceId = req.headers.source_id; | ||||
|  | ||||
|     await sql.doInTransaction(async () => { | ||||
|         await sql.replace("note_revisions", req.body); | ||||
|  | ||||
|         await sync_table.addNoteRevisionSync(req.body.noteRevisionId, sourceId); | ||||
|     }); | ||||
|  | ||||
|     res.send(); | ||||
| })); | ||||
|  | ||||
| module.exports = router; | ||||
| module.exports = { | ||||
|     getNoteRevisions | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user