Skip to content

Build your personal knowledge base with Trilium Notes

chore(core): get rid of note_interface

Elian Dorande4d07e904a2
diff --git a/apps/server/src/services/note-interface.ts b/apps/server/src/services/note-interface.ts
deleted file mode 100644
index 5ebaa6dfa7..0000000000
--- a/apps/server/src/services/note-interface.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { NoteType } from "@triliumnext/commons";
-
-export interface NoteParams {
- /** optionally can force specific noteId */
- noteId?: string;
- branchId?: string;
- parentNoteId: string;
- templateNoteId?: string;
- title: string;
- content: string | Buffer;
- /** text, code, file, image, search, book, relationMap, canvas, webView */
- type: NoteType;
- /** default value is derived from default mimes for type */
- mime?: string;
- /** default is false */
- isProtected?: boolean;
- /** default is false */
- isExpanded?: boolean;
- /** default is empty string */
- prefix?: string;
- /** default is the last existing notePosition in a parent + 10 */
- notePosition?: number;
- dateCreated?: string;
- utcDateCreated?: string;
- ignoreForbiddenParents?: boolean;
- target?: "into";
-}
diff --git a/packages/trilium-core/src/services/notes.ts b/packages/trilium-core/src/services/notes.ts
index d4e1f736be..39cb59be91 100644
--- a/packages/trilium-core/src/services/notes.ts
+++ b/packages/trilium-core/src/services/notes.ts
@@ -1,4 +1,4 @@
-import type { AttachmentRow, AttributeRow, BranchRow, NoteRow } from "@triliumnext/commons";
+import type { AttachmentRow, AttributeRow, BranchRow, NoteRow, NoteType } from "@triliumnext/commons";
import { dayjs } from "@triliumnext/commons";
import { date_utils, events as eventService, ValidationError } from "@triliumnext/core";
import fs from "fs";
@@ -39,6 +39,32 @@ interface Attachment {
title: string;
}
+interface NoteParams {
+ /** optionally can force specific noteId */
+ noteId?: string;
+ branchId?: string;
+ parentNoteId: string;
+ templateNoteId?: string;
+ title: string;
+ content: string | Uint8Array;
+ /** text, code, file, image, search, book, relationMap, canvas, webView */
+ type: NoteType;
+ /** default value is derived from default mimes for type */
+ mime?: string;
+ /** default is false */
+ isProtected?: boolean;
+ /** default is false */
+ isExpanded?: boolean;
+ /** default is empty string */
+ prefix?: string;
+ /** default is the last existing notePosition in a parent + 10 */
+ notePosition?: number;
+ dateCreated?: string;
+ utcDateCreated?: string;
+ ignoreForbiddenParents?: boolean;
+ target?: "into";
+}
+
function getNewNotePosition(parentNote: BNote) {
if (parentNote.isLabelTruthy("newNotesOnTop")) {
const minNotePos = parentNote