copying attachments WIP

This commit is contained in:
zadam
2023-04-25 00:01:58 +02:00
parent 49fb913eab
commit 330e7ac08e
7 changed files with 50 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
const sql = require("../services/sql");
const NoteSet = require("../services/search/note_set");
const BAttachment = require("./entities/battachment.js");
/**
* Becca is a backend cache of all notes, branches and attributes. There's a similar frontend cache Froca.
@@ -129,6 +130,13 @@ class Becca {
return row ? new BAttachment(row) : null;
}
/** @returns {BAttachment[]} */
getAttachments(attachmentIds) {
const BAttachment = require("./entities/battachment"); // avoiding circular dependency problems
return sql.getManyRows("SELECT * FROM attachments WHERE attachmentId IN (???) AND isDeleted = 0", attachmentIds)
.map(row => new BAttachment(row));
}
/** @returns {BOption|null} */
getOption(name) {
return this.options[name];