Added: js style docs for sublevel utils

This commit is contained in:
Llewellyn D'souza
2021-12-29 16:31:14 +05:30
parent a48cbae6f9
commit b3f96ca8cd

View File

@@ -1,10 +1,26 @@
const Sublevel = require("../../models/Sublevel");
const Level = require("../../models/Level");
// const Level = require("../../models/Level");
// exports.moveSublevel = async (sub_level_id, under_sub_or_level_id, isMainLevel) => {
// };
/**
* To move a sub level
* @param {string} sub_level_id The Sublevel to me moved
* @param {string} parent_sub_or_level_id The Level/Sublevel under which to be moved
* @returns {{success: boolean, message: string}}
*/
exports.moveSublevel = async (sub_level_id, parent_sub_or_level_id) => {
/**
* - Check if depths of parent_sub_level_id and parent_sub_or_level_id are same
* - Copy and add references
* - Delete and remove references
*/
return { success: false, message: "not implemented" };
};
/**
* To delete a sub level and all corresponding sub levels under it
* @param {string} root_sub_level_id The root Sublevel ID
* @returns {string[]} The Sublevel IDs that have been deleted
*/
exports.deleteSubLevelTreeFromRoot = async (root_sub_level_id) => {
let sub_level_ids = [];
let temp_sub_level_ids = [root_sub_level_id];