Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(server): mark ownerId in AttachmentRow as mandatory
Elian Doran27efa8844e87
diff --git a/apps/server/src/becca/entities/bnote.ts b/apps/server/src/becca/entities/bnote.tsindex 4eb92c80d9..56a0e99c6e 100644--- a/apps/server/src/becca/entities/bnote.ts+++ b/apps/server/src/becca/entities/bnote.ts@@ -1623,7 +1623,7 @@ class BNote extends AbstractBeccaEntity<BNote> {* @param matchBy - choose by which property we detect if to update an existing attachment.* Supported values are either 'attachmentId' (default) or 'title'*/- saveAttachment({ attachmentId, role, mime, title, content, position }: AttachmentRow, matchBy: "attachmentId" | "title" | undefined = "attachmentId") {+ saveAttachment({ attachmentId, role, mime, title, content, position }: Omit<AttachmentRow, "ownerId">, matchBy: "attachmentId" | "title" | undefined = "attachmentId") {if (!["attachmentId", "title"].includes(matchBy)) {throw new Error(`Unsupported value '${matchBy}' for matchBy param, has to be either 'attachmentId' or 'title'.`);}diff --git a/packages/commons/src/lib/rows.ts b/packages/commons/src/lib/rows.tsindex 5710cf84f7..809e36481d 100644--- a/packages/commons/src/lib/rows.ts+++ b/packages/commons/src/lib/rows.ts@@ -3,7 +3,7 @@export interface AttachmentRow {attachmentId?: string;- ownerId?: string;+ ownerId: string;role: string;mime: string;title: string;