mirror of
https://github.com/zadam/trilium.git
synced 2026-02-20 20:54:26 +01:00
chore(core): port relation map route
This commit is contained in:
parent
08f1d44d90
commit
7d30771f05
@ -40,7 +40,6 @@ import otherRoute from "./api/other.js";
|
||||
import passwordApiRoute from "./api/password.js";
|
||||
import recentChangesApiRoute from "./api/recent_changes.js";
|
||||
import recoveryCodes from './api/recovery_codes.js';
|
||||
import relationMapApiRoute from "./api/relation-map.js";
|
||||
import scriptRoute from "./api/script.js";
|
||||
import searchRoute from "./api/search.js";
|
||||
import senderRoute from "./api/sender.js";
|
||||
@ -257,7 +256,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);
|
||||
|
||||
apiRoute(PST, "/api/relation-map", relationMapApiRoute.getRelationMap);
|
||||
asyncApiRoute(GET, "/api/similar-notes/:noteId", similarNotesRoute.getSimilarNotes);
|
||||
asyncApiRoute(GET, "/api/backend-log", backendLogRoute.getBackendLog);
|
||||
route(GET, "/api/fonts", [auth.checkApiAuthOrElectron], fontsRoute.getFontCss);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Request } from "express";
|
||||
import becca from "../../becca/becca.js";
|
||||
import sql from "../../services/sql.js";
|
||||
import { RelationMapPostResponse } from "@triliumnext/commons";
|
||||
import { getSql } from "../../services/sql/index.js";
|
||||
|
||||
function getRelationMap(req: Request) {
|
||||
const { relationMapNoteId, noteIds } = req.body;
|
||||
@ -30,7 +30,7 @@ function getRelationMap(req: Request) {
|
||||
const hideRelationsVal = relationMapNote.getLabelValue("hideRelations");
|
||||
const hideRelations = !hideRelationsVal ? [] : hideRelationsVal.split(",").map((token) => token.trim());
|
||||
|
||||
const foundNoteIds = sql.getColumn<string>(/*sql*/`SELECT noteId FROM notes WHERE isDeleted = 0 AND noteId IN (${questionMarks})`, noteIds);
|
||||
const foundNoteIds = getSql().getColumn<string>(/*sql*/`SELECT noteId FROM notes WHERE isDeleted = 0 AND noteId IN (${questionMarks})`, noteIds);
|
||||
const notes = becca.getNotes(foundNoteIds);
|
||||
|
||||
for (const note of notes) {
|
||||
@ -14,6 +14,7 @@ import cloningApiRoute from "./api/cloning";
|
||||
import sqlRoute from "./api/sql";
|
||||
import attributesRoute from "./api/attributes";
|
||||
import revisionsApiRoute from "./api/revisions";
|
||||
import relationMapApiRoute from "./api/relation-map";
|
||||
|
||||
// TODO: Deduplicate with routes.ts
|
||||
const GET = "get",
|
||||
@ -109,6 +110,7 @@ export function buildSharedApiRoutes(apiRoute: any) {
|
||||
|
||||
apiRoute(GET, "/api/app-info", appInfoRoute.getAppInfo);
|
||||
apiRoute(GET, "/api/other/icon-usage", otherRoute.getIconUsage);
|
||||
apiRoute(PST, "/api/relation-map", relationMapApiRoute.getRelationMap);
|
||||
}
|
||||
|
||||
/** Handling common patterns. If entity is not caught, serialization to JSON will fail */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user