2018-01-13 18:02:41 -05:00
|
|
|
"use strict";
|
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
import { Request } from 'express';
|
|
|
|
import cloningService = require('../../services/cloning');
|
2018-01-13 18:02:41 -05:00
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
function cloneNoteToBranch(req: Request) {
|
2020-05-31 22:33:02 +02:00
|
|
|
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
|
|
|
|
2021-12-27 23:39:46 +01:00
|
|
|
return cloningService.cloneNoteToBranch(noteId, parentBranchId, prefix);
|
|
|
|
}
|
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
function cloneNoteToParentNote(req: Request) {
|
2021-12-27 23:39:46 +01:00
|
|
|
const {noteId, parentNoteId} = req.params;
|
|
|
|
const {prefix} = req.body;
|
|
|
|
|
2023-04-15 00:06:13 +02:00
|
|
|
return cloningService.cloneNoteToParentNote(noteId, parentNoteId, prefix);
|
2018-03-30 13:20:36 -04:00
|
|
|
}
|
2018-01-13 18:02:41 -05:00
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
function cloneNoteAfter(req: Request) {
|
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
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
function toggleNoteInParent(req: Request) {
|
2022-12-04 13:16:05 +01:00
|
|
|
const {noteId, parentNoteId, present} = req.params;
|
|
|
|
|
|
|
|
return cloningService.toggleNoteInParent(present === 'true', noteId, parentNoteId);
|
|
|
|
}
|
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
export = {
|
2021-12-27 23:39:46 +01:00
|
|
|
cloneNoteToBranch,
|
2023-04-15 00:06:13 +02:00
|
|
|
cloneNoteToParentNote,
|
2022-12-04 13:16:05 +01:00
|
|
|
cloneNoteAfter,
|
|
|
|
toggleNoteInParent
|
2020-05-31 22:33:02 +02:00
|
|
|
};
|