migrating canvas etc.

This commit is contained in:
zadam
2023-01-23 16:57:28 +01:00
parent 339d8a7378
commit 8a33645360
6 changed files with 115 additions and 5 deletions

View File

@@ -1116,6 +1116,12 @@ class BNote extends AbstractBeccaEntity {
.map(row => new BNoteAttachment(row));
}
getNoteAttachmentByName(name) {
return sql.getRows("SELECT * FROM note_attachments WHERE noteId = ? AND name = ? AND isDeleted = 0", [this.noteId, name])
.map(row => new BNoteAttachment(row))
[0];
}
/**
* @returns {string[][]} - array of notePaths (each represented by array of noteIds constituting the particular note path)
*/
@@ -1429,6 +1435,25 @@ class BNote extends AbstractBeccaEntity {
return noteRevision;
}
/**
* @returns {BNoteAttachment}
*/
saveNoteAttachment(name, mime, content) {
this.getNoteAttachments()
const noteAttachment = new BNoteAttachment({
name,
mime,
isProtected: this.isProtected
});
noteAttachment.save();
noteAttachment.setContent(content);
return noteAttachment;
}
beforeSaving() {
super.beforeSaving();