mirror of
https://github.com/strapi/strapi.git
synced 2025-08-02 13:58:18 +00:00
20 lines
440 B
JavaScript
20 lines
440 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const findModelByAssoc = ({ assoc }) => {
|
||
|
const target = assoc.collection || assoc.model;
|
||
|
return assoc.plugin === 'admin'
|
||
|
? strapi.admin.models[target]
|
||
|
: assoc.plugin
|
||
|
? strapi.plugins[assoc.plugin].models[target]
|
||
|
: strapi.models[target];
|
||
|
};
|
||
|
|
||
|
const isPolymorphic = ({ assoc }) => {
|
||
|
return assoc.nature.toLowerCase().indexOf('morph') !== -1;
|
||
|
};
|
||
|
|
||
|
module.exports = {
|
||
|
findModelByAssoc,
|
||
|
isPolymorphic,
|
||
|
};
|