refactored backend to use new naming convention for modules

This commit is contained in:
azivner
2018-04-01 21:27:46 -04:00
parent c765dbc5cf
commit e2921a648d
44 changed files with 305 additions and 310 deletions

View File

@@ -1,11 +1,11 @@
"use strict";
const labels = require('../../services/labels');
const script = require('../../services/script');
const labelService = require('../../services/labels');
const scriptService = require('../../services/script');
const repository = require('../../services/repository');
async function exec(req) {
const result = await script.executeScript(req.body.script, req.body.params, req.body.startNoteId, req.body.currentNoteId);
const result = await scriptService.executeScript(req.body.script, req.body.params, req.body.startNoteId, req.body.currentNoteId);
return { executionResult: result };
}
@@ -13,18 +13,18 @@ async function exec(req) {
async function run(req) {
const note = await repository.getNote(req.params.noteId);
const result = await script.executeNote(req, note);
const result = await scriptService.executeNote(req, note);
return { executionResult: result };
}
async function getStartupBundles(req) {
const notes = await labels.getNotesWithLabel("run", "frontend_startup");
const notes = await labelService.getNotesWithLabel("run", "frontend_startup");
const bundles = [];
for (const note of notes) {
const bundle = await script.getScriptBundle(note);
const bundle = await scriptService.getScriptBundle(note);
if (bundle) {
bundles.push(bundle);
@@ -36,7 +36,7 @@ async function getStartupBundles(req) {
async function getBundle(req) {
const note = await repository.getNote(req.params.noteId);
return await script.getScriptBundle(note);
return await scriptService.getScriptBundle(note);
}
module.exports = {