image upload fixes + some API changes

This commit is contained in:
azivner
2018-08-11 19:45:55 +02:00
parent 9e96272eb3
commit 0f42c396f3
6 changed files with 36 additions and 8 deletions

View File

@@ -9,6 +9,8 @@ const treeService = require('./tree');
const config = require('./config');
const repository = require('./repository');
const axios = require('axios');
const cloningService = require('./cloning');
const messagingService = require('./messaging');
function ScriptContext(startNote, allNotes, originEntity = null) {
this.modules = {};
@@ -54,6 +56,9 @@ function ScriptApi(startNote, currentNote, originEntity) {
this.getNotesWithLabel = attributeService.getNotesWithLabel;
this.getNoteWithLabel = attributeService.getNoteWithLabel;
this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent;
this.ensureNoteIsAbsentFromParent = cloningService.ensureNoteIsAbsentFromParent;
this.createNote = noteService.createNote;
this.log = message => log.info(`Script ${currentNote.noteId}: ${message}`);
@@ -64,6 +69,8 @@ function ScriptApi(startNote, currentNote, originEntity) {
this.sortNotesAlphabetically = treeService.sortNotesAlphabetically;
this.transactional = sql.transactional;
this.refreshTree = () => messagingService.sendMessageToAllClients({ type: 'refresh-tree' });
}
module.exports = ScriptContext;