mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
22 lines
496 B
JavaScript
22 lines
496 B
JavaScript
"use strict";
|
|
|
|
const similarityService = require('../../becca/similarity');
|
|
const becca = require("../../becca/becca");
|
|
const NotFoundError = require("../../errors/not_found_error");
|
|
|
|
async function getSimilarNotes(req) {
|
|
const noteId = req.params.noteId;
|
|
|
|
const note = becca.getNote(noteId);
|
|
|
|
if (!note) {
|
|
throw new NotFoundError(`Note '${noteId}' not found.`);
|
|
}
|
|
|
|
return await similarityService.findSimilarNotes(noteId);
|
|
}
|
|
|
|
module.exports = {
|
|
getSimilarNotes
|
|
};
|