Add allowedTypes in media type meta

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
Alexandre Bodin 2020-03-12 09:44:04 +01:00
parent 32c021db37
commit c4bf0cdb67
2 changed files with 4 additions and 6 deletions

View File

@ -86,6 +86,7 @@ const formatAttribute = (key, attribute, { model }) => {
type: 'media',
multiple: attribute.collection ? true : false,
required: attribute.required ? true : false,
allowedTypes: attribute.allowedTypes,
};
} else {
return {

View File

@ -29,9 +29,7 @@ const hasComponent = model => {
const isConfigurable = attribute => _.get(attribute, 'configurable', true);
const isRelation = attribute =>
_.has(attribute, 'target') ||
_.has(attribute, 'model') ||
_.has(attribute, 'collection');
_.has(attribute, 'target') || _.has(attribute, 'model') || _.has(attribute, 'collection');
/**
* Formats a component's attributes
@ -57,9 +55,7 @@ const formatAttribute = (key, attribute, { model }) => {
if (_.has(attribute, 'type')) return attribute;
// format relations
const relation = (model.associations || []).find(
assoc => assoc.alias === key
);
const relation = (model.associations || []).find(assoc => assoc.alias === key);
const { plugin, configurable } = attribute;
let targetEntity = attribute.model || attribute.collection;
@ -69,6 +65,7 @@ const formatAttribute = (key, attribute, { model }) => {
multiple: attribute.collection ? true : false,
required: attribute.required ? true : false,
configurable: configurable === false ? false : undefined,
allowedTypes: attribute.allowedTypes,
};
} else {
return {