Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_.forEach(definition.attributes, function (details, name) {
const verbose = _.get(utilsModels.getNature(details, name), 'verbose') || '';
// Build associations key
if (!_.isEmpty(verbose)) {
utilsModels.defineAssociations(globalName, definition, details, name);
}
switch (verbose) {
case 'hasOne':
const FK = _.findKey(strapi.models[details.model].attributes, function (details) {
if (details.hasOwnProperty('model') && details.model === model && details.hasOwnProperty('via') && details.via === name) {
return details;
}
});
loadedModel[name] = function () {
return this.hasOne(global[_.capitalize(details.model)], FK);
};
break;
case 'hasMany':