fix: Remove recursive config sanitisation
parent
d101e3cc43
commit
a8e2180713
|
@ -47,6 +47,11 @@ const dynamicSort = (property) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const sanitizeConfig = (config, relation, relationSortFields) => {
|
const sanitizeConfig = (config, relation, relationSortFields) => {
|
||||||
|
delete config._id;
|
||||||
|
delete config.id;
|
||||||
|
delete config.updatedAt;
|
||||||
|
delete config.createdAt;
|
||||||
|
|
||||||
if (relation) {
|
if (relation) {
|
||||||
const formattedRelations = [];
|
const formattedRelations = [];
|
||||||
|
|
||||||
|
@ -69,20 +74,6 @@ const sanitizeConfig = (config, relation, relationSortFields) => {
|
||||||
config[relation] = formattedRelations;
|
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;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue