mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 18:39:22 +08:00
refactor(serve): solve some more type errors
This commit is contained in:
parent
d8cb933b2b
commit
3b6679a744
@ -116,7 +116,7 @@ function getLinkMap(req: Request) {
|
|||||||
}).notes;
|
}).notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const noteIds = new Set(unfilteredNotes.filter((note) => ignoreExcludeFromNoteMap || !note.isLabelTruthy("excludeFromNoteMap")).map((note) => note.noteId));
|
const noteIds = new Set<string>(unfilteredNotes.filter((note) => ignoreExcludeFromNoteMap || !note.isLabelTruthy("excludeFromNoteMap")).map((note) => note.noteId));
|
||||||
|
|
||||||
if (mapRootNote.type === "search") {
|
if (mapRootNote.type === "search") {
|
||||||
noteIds.delete(mapRootNote.noteId);
|
noteIds.delete(mapRootNote.noteId);
|
||||||
|
@ -118,7 +118,7 @@ function createNote(req: Request) {
|
|||||||
throw new ValidationError("Missing or incorrect type for target branch ID.");
|
throw new ValidationError("Missing or incorrect type for target branch ID.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const { note, branch } = noteService.createNewNoteWithTarget(target, targetBranchId, params);
|
const { note, branch } = noteService.createNewNoteWithTarget(target, String(targetBranchId), params);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
note,
|
note,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import express from "express";
|
import express, { type RequestHandler } from "express";
|
||||||
import multer from "multer";
|
import multer from "multer";
|
||||||
import log from "../services/log.js";
|
import log from "../services/log.js";
|
||||||
import cls from "../services/cls.js";
|
import cls from "../services/cls.js";
|
||||||
@ -166,7 +166,7 @@ function handleException(e: unknown | Error, method: HttpMethod, path: string, r
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createUploadMiddleware() {
|
export function createUploadMiddleware(): RequestHandler {
|
||||||
const multerOptions: multer.Options = {
|
const multerOptions: multer.Options = {
|
||||||
fileFilter: (req: express.Request, file, cb) => {
|
fileFilter: (req: express.Request, file, cb) => {
|
||||||
// UTF-8 file names are not well decoded by multer/busboy, so we handle the conversion on our side.
|
// UTF-8 file names are not well decoded by multer/busboy, so we handle the conversion on our side.
|
||||||
|
@ -3,6 +3,7 @@ import session, { Store } from "express-session";
|
|||||||
import sessionSecret from "../services/session_secret.js";
|
import sessionSecret from "../services/session_secret.js";
|
||||||
import config from "../services/config.js";
|
import config from "../services/config.js";
|
||||||
import log from "../services/log.js";
|
import log from "../services/log.js";
|
||||||
|
import type express from "express";
|
||||||
|
|
||||||
class SQLiteSessionStore extends Store {
|
class SQLiteSessionStore extends Store {
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ class SQLiteSessionStore extends Store {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionParser = session({
|
const sessionParser: express.RequestHandler = session({
|
||||||
secret: sessionSecret,
|
secret: sessionSecret,
|
||||||
resave: false, // true forces the session to be saved back to the session store, even if the session was never modified during the request.
|
resave: false, // true forces the session to be saved back to the session store, even if the session was never modified during the request.
|
||||||
saveUninitialized: false, // true forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified.
|
saveUninitialized: false, // true forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified.
|
||||||
|
@ -5,7 +5,7 @@ import becca from "../becca/becca.js";
|
|||||||
import type BNote from "../becca/entities/bnote.js";
|
import type BNote from "../becca/entities/bnote.js";
|
||||||
import type { ApiParams } from "./backend_script_api_interface.js";
|
import type { ApiParams } from "./backend_script_api_interface.js";
|
||||||
|
|
||||||
interface Bundle {
|
export interface Bundle {
|
||||||
note?: BNote;
|
note?: BNote;
|
||||||
noteId?: string;
|
noteId?: string;
|
||||||
script: string;
|
script: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user