strapi/packages/core/utils/lib/relations.js

17 lines
349 B
JavaScript
Raw Normal View History

2020-12-01 16:38:47 +01:00
'use strict';
2021-08-06 10:51:34 +02:00
const MANY_RELATIONS = ['oneToMany', 'manyToMany'];
2020-12-18 11:24:52 +01:00
2021-07-08 18:15:32 +02:00
const getRelationalFields = contentType => {
return Object.keys(contentType.attributes).filter(attributeName => {
return contentType.attributes[attributeName].type === 'relation';
});
2020-12-18 11:24:52 +01:00
};
2020-12-01 16:38:47 +01:00
module.exports = {
2020-12-18 11:24:52 +01:00
getRelationalFields,
2020-12-16 15:28:11 +01:00
constants: {
MANY_RELATIONS,
},
2020-12-01 16:38:47 +01:00
};