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', type: 'media',
multiple: attribute.collection ? true : false, multiple: attribute.collection ? true : false,
required: attribute.required ? true : false, required: attribute.required ? true : false,
allowedTypes: attribute.allowedTypes,
}; };
} else { } else {
return { return {

View File

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