Create a dataloader for every model

This commit is contained in:
Alexandre Bodin 2019-10-07 13:47:47 +02:00
parent 61318bbed2
commit 0b21fd4e7f

View File

@ -19,24 +19,13 @@ module.exports = {
Object.keys(strapi.models)
.filter(model => model !== 'core_store')
.forEach(model => {
(strapi.models[model].associations || []).forEach(association =>
this.createLoader(
association.collection || association.model,
association.plugin
)
);
this.createLoader(model);
});
// Reproduce the same pattern for each plugin.
Object.keys(strapi.plugins).forEach(plugin => {
Object.keys(strapi.plugins[plugin].models).forEach(model => {
(strapi.plugins[plugin].models[model].associations || []).forEach(
association =>
this.createLoader(
association.collection || association.model,
association.plugin
)
);
this.createLoader(model, plugin);
});
});
},