2018-01-13 18:02:41 -05:00
|
|
|
"use strict";
|
|
|
|
|
|
2025-01-09 18:36:24 +02:00
|
|
|
import type { Request } from "express";
|
2024-07-18 21:35:17 +03:00
|
|
|
import cloningService from "../../services/cloning.js";
|
2018-01-13 18:02:41 -05:00
|
|
|
|
2024-04-05 20:47:07 +03:00
|
|
|
function cloneNoteToBranch(req: Request) {
|
2025-01-09 18:07:02 +02:00
|
|
|
const { noteId, parentBranchId } = req.params;
|
|
|
|
|
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) {
|
2025-01-09 18:07:02 +02:00
|
|
|
const { noteId, parentNoteId } = req.params;
|
|
|
|
|
const { prefix } = req.body;
|
2021-12-27 23:39:46 +01:00
|
|
|
|
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) {
|
2025-01-09 18:07:02 +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) {
|
2025-01-09 18:07:02 +02:00
|
|
|
const { noteId, parentNoteId, present } = req.params;
|
2022-12-04 13:16:05 +01:00
|
|
|
|
2025-01-09 18:07:02 +02:00
|
|
|
return cloningService.toggleNoteInParent(present === "true", noteId, parentNoteId);
|
2022-12-04 13:16:05 +01:00
|
|
|
}
|
|
|
|
|
|
2024-07-18 21:47:30 +03:00
|
|
|
export default {
|
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
|
|
|
};
|