refactor(server): mark ownerId in AttachmentRow as mandatory

This commit is contained in:
Elian Doran 2025-12-26 17:32:28 +02:00
parent 98de4b6dc3
commit 27efa8844e
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -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'.`);
}

View File

@ -3,7 +3,7 @@
export interface AttachmentRow {
attachmentId?: string;
ownerId?: string;
ownerId: string;
role: string;
mime: string;
title: string;