@digicms/cms
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
23 lines (19 loc) • 762 B
JavaScript
;
const convertCustomFieldType = (strapi) => {
const allContentTypeSchemaAttributes = Object.values(strapi.contentTypes).map(
(schema) => schema.attributes
);
const allComponentSchemaAttributes = Object.values(strapi.components).map(
(schema) => schema.attributes
);
const allSchemasAttributes = [...allContentTypeSchemaAttributes, ...allComponentSchemaAttributes];
for (const schemaAttrbutes of allSchemasAttributes) {
for (const attribute of Object.values(schemaAttrbutes)) {
if (attribute.type === 'customField') {
const customField = strapi.container.get('custom-fields').get(attribute.customField);
attribute.type = customField.type;
}
}
}
};
module.exports = convertCustomFieldType;