mirror of
https://github.com/zadam/trilium.git
synced 2026-05-09 13:56:54 +02:00
feat(core): integrate similar_notes route
This commit is contained in:
@@ -36,7 +36,6 @@ import recoveryCodes from './api/recovery_codes.js';
|
||||
import scriptRoute from "./api/script.js";
|
||||
import senderRoute from "./api/sender.js";
|
||||
import setupApiRoute from "./api/setup.js";
|
||||
import similarNotesRoute from "./api/similar_notes.js";
|
||||
import systemInfoRoute from "./api/system_info.js";
|
||||
import totp from './api/totp.js';
|
||||
// API routes
|
||||
@@ -212,7 +211,6 @@ function register(app: express.Application) {
|
||||
asyncRoute(PST, "/api/sender/image", [auth.checkEtapiToken, uploadMiddlewareWithErrorHandling], senderRoute.uploadImage, apiResultHandler);
|
||||
asyncRoute(PST, "/api/sender/note", [auth.checkEtapiToken], senderRoute.saveNote, apiResultHandler);
|
||||
|
||||
asyncApiRoute(GET, "/api/similar-notes/:noteId", similarNotesRoute.getSimilarNotes);
|
||||
asyncApiRoute(GET, "/api/backend-log", backendLogRoute.getBackendLog);
|
||||
route(GET, "/api/fonts", [auth.checkApiAuthOrElectron], fontsRoute.getFontCss);
|
||||
apiRoute(PST, "/api/other/render-markdown", otherRoute.renderMarkdown);
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { SimilarNoteResponse } from "@triliumnext/commons";
|
||||
import { similarity } from "@triliumnext/core";
|
||||
import type { Request } from "express";
|
||||
|
||||
import becca from "../../becca/becca.js";
|
||||
import similarity from "../../becca/similarity.js";
|
||||
|
||||
async function getSimilarNotes(req: Request<{ noteId: string }>) {
|
||||
const noteId = req.params.noteId;
|
||||
|
||||
const _note = becca.getNoteOrThrow(noteId);
|
||||
becca.getNoteOrThrow(noteId);
|
||||
|
||||
return (await similarity.findSimilarNotes(noteId) satisfies SimilarNoteResponse);
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import searchRoute from "./api/search";
|
||||
import specialNotesRoute from "./api/special_notes";
|
||||
import syncApiRoute from "./api/sync";
|
||||
import autocompleteApiRoute from "./api/autocomplete";
|
||||
import similarNotesRoute from "./api/similar_notes";
|
||||
|
||||
// TODO: Deduplicate with routes.ts
|
||||
const GET = "get",
|
||||
@@ -165,6 +166,7 @@ export function buildSharedApiRoutes({ route, apiRoute, asyncApiRoute, checkApiA
|
||||
|
||||
apiRoute(GET, "/api/app-info", appInfoRoute.getAppInfo);
|
||||
apiRoute(GET, "/api/other/icon-usage", otherRoute.getIconUsage);
|
||||
asyncApiRoute(GET, "/api/similar-notes/:noteId", similarNotesRoute.getSimilarNotes);
|
||||
apiRoute(PST, "/api/relation-map", relationMapApiRoute.getRelationMap);
|
||||
apiRoute(GET, "/api/recent-changes/:ancestorNoteId", recentChangesApiRoute.getRecentChanges);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user