refactoring of note creation APIs WIP

This commit is contained in:
zadam
2019-11-16 11:09:52 +01:00
parent de02e9e889
commit 13c0411533
13 changed files with 115 additions and 107 deletions

View File

@@ -57,14 +57,17 @@ async function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSw
const parentNote = await repository.getNote(parentNoteId);
const {note} = await noteService.createNote(parentNoteId, fileName, buffer, {
target: 'into',
const {note} = await noteService.createNewNote({
parentNoteId,
title: fileName,
content: buffer,
type: 'image',
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
mime: 'image/' + imageFormat.ext.toLowerCase(),
attributes: [{ type: 'label', name: 'originalFileName', value: originalName }]
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable()
});
await note.addLabel('originalFileName', originalName);
return {
fileName,
note,