Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove recursive config sanitisation #113

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading