Skip to content

Commit

Permalink
fix: Remove recursive config sanitisation
Browse files Browse the repository at this point in the history
  • Loading branch information
boazpoolman committed Oct 20, 2023
1 parent d101e3c commit a8e2180
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions server/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand All @@ -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;
};

Expand Down

0 comments on commit a8e2180

Please sign in to comment.