mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			536 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			536 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
"use strict";
 | 
						|
 | 
						|
const noteCacheService = require('../../services/note_cache/note_cache_service');
 | 
						|
const repository = require('../../services/repository');
 | 
						|
 | 
						|
async function getSimilarNotes(req) {
 | 
						|
    const noteId = req.params.noteId;
 | 
						|
 | 
						|
    const note = repository.getNote(noteId);
 | 
						|
 | 
						|
    if (!note) {
 | 
						|
        return [404, `Note ${noteId} not found.`];
 | 
						|
    }
 | 
						|
 | 
						|
    const results = await noteCacheService.findSimilarNotes(noteId);
 | 
						|
 | 
						|
    return results
 | 
						|
        .filter(note => note.noteId !== noteId);
 | 
						|
}
 | 
						|
 | 
						|
module.exports = {
 | 
						|
    getSimilarNotes
 | 
						|
};
 |