mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
blob WIP
This commit is contained in:
@@ -127,7 +127,7 @@ function setNoteTypeMime(req) {
|
||||
note.save();
|
||||
}
|
||||
|
||||
function getNoteAttachments(req) {
|
||||
function getAttachments(req) {
|
||||
const includeContent = req.query.includeContent === 'true';
|
||||
const {noteId} = req.params;
|
||||
|
||||
@@ -137,9 +137,9 @@ function getNoteAttachments(req) {
|
||||
throw new NotFoundError(`Note '${noteId}' doesn't exist.`);
|
||||
}
|
||||
|
||||
const noteAttachments = note.getNoteAttachments();
|
||||
const attachments = note.getAttachments();
|
||||
|
||||
return noteAttachments.map(attachment => {
|
||||
return attachments.map(attachment => {
|
||||
const pojo = attachment.getPojo();
|
||||
|
||||
if (includeContent && utils.isStringNote(null, attachment.mime)) {
|
||||
@@ -157,7 +157,7 @@ function getNoteAttachments(req) {
|
||||
});
|
||||
}
|
||||
|
||||
function saveNoteAttachment(req) {
|
||||
function saveAttachment(req) {
|
||||
const {noteId, name} = req.params;
|
||||
const {mime, content} = req.body;
|
||||
|
||||
@@ -167,7 +167,7 @@ function saveNoteAttachment(req) {
|
||||
throw new NotFoundError(`Note '${noteId}' doesn't exist.`);
|
||||
}
|
||||
|
||||
note.saveNoteAttachment(name, mime, content);
|
||||
note.saveAttachment(name, mime, content);
|
||||
}
|
||||
|
||||
function getRelationMap(req) {
|
||||
@@ -384,6 +384,6 @@ module.exports = {
|
||||
getDeleteNotesPreview,
|
||||
uploadModifiedFile,
|
||||
forceSaveNoteRevision,
|
||||
getNoteAttachments,
|
||||
saveNoteAttachment
|
||||
getAttachments,
|
||||
saveAttachment
|
||||
};
|
||||
|
||||
@@ -113,9 +113,9 @@ function forceNoteSync(req) {
|
||||
entityChangesService.moveEntityChangeToTop('note_revisions', noteRevisionId);
|
||||
}
|
||||
|
||||
for (const noteAttachmentId of sql.getColumn("SELECT noteAttachmentId FROM note_attachments WHERE noteId = ?", [noteId])) {
|
||||
sql.execute(`UPDATE note_attachments SET utcDateModified = ? WHERE noteAttachmentId = ?`, [now, noteAttachmentId]);
|
||||
entityChangesService.moveEntityChangeToTop('note_attachments', noteAttachmentId);
|
||||
for (const attachmentId of sql.getColumn("SELECT attachmentId FROM attachments WHERE noteId = ?", [noteId])) {
|
||||
sql.execute(`UPDATE attachments SET utcDateModified = ? WHERE attachmentId = ?`, [now, attachmentId]);
|
||||
entityChangesService.moveEntityChangeToTop('attachments', attachmentId);
|
||||
}
|
||||
|
||||
log.info(`Forcing note sync for ${noteId}`);
|
||||
|
||||
Reference in New Issue
Block a user