Notes/src/routes/api/cloning.js

37 lines
896 B
JavaScript
Raw Normal View History

2018-01-13 18:02:41 -05:00
"use strict";
const cloningService = require('../../services/cloning');
2018-01-13 18:02:41 -05:00
function cloneNoteToBranch(req) {
const {noteId, parentBranchId} = req.params;
2019-10-26 21:14:06 +02:00
const {prefix} = req.body;
2018-01-13 18:02:41 -05:00
return cloningService.cloneNoteToBranch(noteId, parentBranchId, prefix);
}
function cloneNoteToNote(req) {
const {noteId, parentNoteId} = req.params;
const {prefix} = req.body;
return cloningService.cloneNoteToNote(noteId, parentNoteId, prefix);
2018-03-30 13:20:36 -04:00
}
2018-01-13 18:02:41 -05:00
2020-06-20 12:31:38 +02:00
function cloneNoteAfter(req) {
2019-10-26 21:14:06 +02:00
const {noteId, afterBranchId} = req.params;
2018-01-13 18:02:41 -05:00
2020-06-20 12:31:38 +02:00
return cloningService.cloneNoteAfter(noteId, afterBranchId);
2018-03-30 13:20:36 -04:00
}
2018-01-13 18:02:41 -05:00
2022-12-04 13:16:05 +01:00
function toggleNoteInParent(req) {
const {noteId, parentNoteId, present} = req.params;
return cloningService.toggleNoteInParent(present === 'true', noteId, parentNoteId);
}
2018-03-30 13:20:36 -04:00
module.exports = {
cloneNoteToBranch,
cloneNoteToNote,
2022-12-04 13:16:05 +01:00
cloneNoteAfter,
toggleNoteInParent
};