server-ts: Convert routes/api/cloning

This commit is contained in:
Elian Doran
2024-04-05 20:47:07 +03:00
parent f98f84d419
commit 122ff3bb1d
2 changed files with 9 additions and 8 deletions

37
src/routes/api/cloning.ts Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
import { Request } from 'express';
import cloningService = require('../../services/cloning');
function cloneNoteToBranch(req: Request) {
const {noteId, parentBranchId} = req.params;
const {prefix} = req.body;
return cloningService.cloneNoteToBranch(noteId, parentBranchId, prefix);
}
function cloneNoteToParentNote(req: Request) {
const {noteId, parentNoteId} = req.params;
const {prefix} = req.body;
return cloningService.cloneNoteToParentNote(noteId, parentNoteId, prefix);
}
function cloneNoteAfter(req: Request) {
const {noteId, afterBranchId} = req.params;
return cloningService.cloneNoteAfter(noteId, afterBranchId);
}
function toggleNoteInParent(req: Request) {
const {noteId, parentNoteId, present} = req.params;
return cloningService.toggleNoteInParent(present === 'true', noteId, parentNoteId);
}
export = {
cloneNoteToBranch,
cloneNoteToParentNote,
cloneNoteAfter,
toggleNoteInParent
};