renamed attachment's parentId to more fitting ownerId

This commit is contained in:
zadam
2023-07-14 17:01:56 +02:00
parent ca41806bc2
commit d475346a09
25 changed files with 63 additions and 63 deletions

View File

@@ -5,13 +5,13 @@ const utils = require('../../../services/utils');
const AbstractShacaEntity = require('./abstract_shaca_entity');
class SAttachment extends AbstractShacaEntity {
constructor([attachmentId, parentId, role, mime, title, blobId, utcDateModified]) {
constructor([attachmentId, ownerId, role, mime, title, blobId, utcDateModified]) {
super();
/** @param {string} */
this.attachmentId = attachmentId;
/** @param {string} */
this.parentId = parentId;
this.ownerId = ownerId;
/** @param {string} */
this.title = title;
/** @param {string} */
@@ -24,12 +24,12 @@ class SAttachment extends AbstractShacaEntity {
this.utcDateModified = utcDateModified; // used for caching of images
this.shaca.attachments[this.attachmentId] = this;
this.shaca.notes[this.parentId].attachments.push(this);
this.shaca.notes[this.ownerId].attachments.push(this);
}
/** @returns {SNote} */
get note() {
return this.shaca.notes[this.parentId];
return this.shaca.notes[this.ownerId];
}
getContent(silentNotFoundError = false) {

View File

@@ -67,10 +67,10 @@ function load() {
}
const rawAttachmentRows = sql.getRawRows(`
SELECT attachmentId, parentId, role, mime, title, blobId, utcDateModified
SELECT attachmentId, ownerId, role, mime, title, blobId, utcDateModified
FROM attachments
WHERE isDeleted = 0
AND parentId IN (${noteIdStr})`);
AND ownerId IN (${noteIdStr})`);
rawAttachmentRows.sort((a, b) => a.position < b.position ? -1 : 1);