mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	added "edited notes on date" widget
This commit is contained in:
		@@ -1,12 +1,34 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
const repository = require('../../services/repository');
 | 
			
		||||
const noteCacheService = require('../../services/note_cache');
 | 
			
		||||
 | 
			
		||||
async function getNoteRevisions(req) {
 | 
			
		||||
    const noteId = req.params.noteId;
 | 
			
		||||
    return await repository.getEntities("SELECT * FROM note_revisions WHERE noteId = ? order by utcDateModifiedTo desc", [noteId]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getEditedNotesOnDate(req) {
 | 
			
		||||
    const date = req.params.date;
 | 
			
		||||
 | 
			
		||||
    const notes = await repository.getEntities(`
 | 
			
		||||
        select distinct notes.*
 | 
			
		||||
        from notes
 | 
			
		||||
        left join note_revisions using (noteId)
 | 
			
		||||
        where substr(notes.dateCreated, 0, 11) = ?
 | 
			
		||||
           or substr(notes.dateModified, 0, 11) = ?
 | 
			
		||||
           or substr(note_revisions.dateModifiedFrom, 0, 11) = ?`, [date, date, date]);
 | 
			
		||||
 | 
			
		||||
    for (const note of notes) {
 | 
			
		||||
        const notePath = noteCacheService.getNotePath(note.noteId);
 | 
			
		||||
 | 
			
		||||
        note.notePath = notePath ? notePath.notePath : null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return notes;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    getNoteRevisions
 | 
			
		||||
    getNoteRevisions,
 | 
			
		||||
    getEditedNotesOnDate
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user