Merge pull request #113 from boazpoolman/feature/fix-config-sanitization-utility
fix: Remove recursive config sanitisationpull/114/head
commit
88a40e7dfb
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue