syncification

This commit is contained in:
zadam
2020-06-20 12:31:38 +02:00
parent 30062d687f
commit 88348c560c
97 changed files with 1673 additions and 1700 deletions

View File

@@ -5,7 +5,7 @@ const imageService = require('../../services/image');
const dateNoteService = require('../../services/date_notes');
const noteService = require('../../services/notes');
async function uploadImage(req) {
function uploadImage(req) {
const file = req.file;
if (!["image/png", "image/jpeg", "image/gif"].includes(file.mimetype)) {
@@ -14,19 +14,19 @@ async function uploadImage(req) {
const originalName = "Sender image." + imageType(file.buffer).ext;
const parentNote = await dateNoteService.getDateNote(req.headers['x-local-date']);
const parentNote = dateNoteService.getDateNote(req.headers['x-local-date']);
const {noteId} = await imageService.saveImage(parentNote.noteId, file.buffer, originalName, true);
const {noteId} = imageService.saveImage(parentNote.noteId, file.buffer, originalName, true);
return {
noteId: noteId
};
}
async function saveNote(req) {
const parentNote = await dateNoteService.getDateNote(req.headers['x-local-date']);
function saveNote(req) {
const parentNote = dateNoteService.getDateNote(req.headers['x-local-date']);
const {note, branch} = await noteService.createNewNote({
const {note, branch} = noteService.createNewNote({
parentNoteId: parentNote.noteId,
title: req.body.title,
content: req.body.content,
@@ -44,4 +44,4 @@ async function saveNote(req) {
module.exports = {
uploadImage,
saveNote
};
};