From a8e218071318d60b1caf6925700f7cc7b60c2556 Mon Sep 17 00:00:00 2001 From: Boaz Poolman Date: Fri, 20 Oct 2023 16:59:38 +0200 Subject: [PATCH] fix: Remove recursive config sanitisation --- server/utils/index.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/server/utils/index.js b/server/utils/index.js index 19291d1..4a6c6f9 100644 --- a/server/utils/index.js +++ b/server/utils/index.js @@ -47,6 +47,11 @@ const dynamicSort = (property) => { }; const sanitizeConfig = (config, relation, relationSortFields) => { + delete config._id; + delete config.id; + delete config.updatedAt; + delete config.createdAt; + if (relation) { const formattedRelations = []; @@ -69,20 +74,6 @@ const sanitizeConfig = (config, relation, relationSortFields) => { config[relation] = formattedRelations; } - const recursiveSanitizeConfig = (recursivedSanitizedConfig) => { - delete recursivedSanitizedConfig._id; - delete recursivedSanitizedConfig.id; - delete recursivedSanitizedConfig.updatedAt; - delete recursivedSanitizedConfig.createdAt; - - Object.keys(recursivedSanitizedConfig).map((key, index) => { - if (recursivedSanitizedConfig[key] && typeof recursivedSanitizedConfig[key] === "object") { - recursiveSanitizeConfig(recursivedSanitizedConfig[key]); - } - }); - }; - recursiveSanitizeConfig(config); - return config; };