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,7 +1,7 @@
"use strict";
const notes = require('../../services/notes');
const tree = require('../../services/tree');
const noteService = require('../../services/notes');
const treeService = require('../../services/tree');
const repository = require('../../services/repository');
async function getNote(req) {
@@ -24,7 +24,7 @@ async function createNote(req) {
const parentNoteId = req.params.parentNoteId;
const newNote = req.body;
const { note, branch } = await notes.createNewNote(parentNoteId, newNote, req);
const { note, branch } = await noteService.createNewNote(parentNoteId, newNote, req);
return {
note,
@@ -36,13 +36,13 @@ async function updateNote(req) {
const note = req.body;
const noteId = req.params.noteId;
await notes.updateNote(noteId, note);
await noteService.updateNote(noteId, note);
}
async function sortNotes(req) {
const noteId = req.params.noteId;
await tree.sortNotesAlphabetically(noteId);
await treeService.sortNotesAlphabetically(noteId);
}
async function protectBranch(req) {
@@ -50,7 +50,7 @@ async function protectBranch(req) {
const note = repository.getNote(noteId);
const protect = !!parseInt(req.params.isProtected);
await notes.protectNoteRecursively(note, protect);
await noteService.protectNoteRecursively(note, protect);
}
async function setNoteTypeMime(req) {