mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +00:00
Fix delete info.mainFied in content type builder fix #1301
This commit is contained in:
parent
07f2c3aea5
commit
d240e2ac82
@ -86,7 +86,7 @@ module.exports = {
|
||||
|
||||
updateModel: async ctx => {
|
||||
const { model } = ctx.params;
|
||||
const { name, description, connection, collectionName, attributes = [], plugin } = ctx.request.body;
|
||||
const { name, description, mainField, connection, collectionName, attributes = [], plugin } = ctx.request.body;
|
||||
|
||||
if (!name) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.name.missing' }] }]);
|
||||
if (!_.includes(Service.getConnections(), connection)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.connection.unknow' }] }]);
|
||||
@ -122,6 +122,10 @@ module.exports = {
|
||||
};
|
||||
modelJSON.attributes = formatedAttributes;
|
||||
|
||||
if (mainField) {
|
||||
modelJSON.info.mainField = mainField;
|
||||
}
|
||||
|
||||
const clearRelationsErrors = Service.clearRelations(model, plugin);
|
||||
|
||||
if (!_.isEmpty(clearRelationsErrors)) {
|
||||
|
@ -105,6 +105,7 @@ module.exports = {
|
||||
return {
|
||||
name: _.get(model, 'info.name', 'model.name.missing'),
|
||||
description: _.get(model, 'info.description', 'model.description.missing'),
|
||||
mainField: _.get(model, 'info.mainField', ''),
|
||||
connection: model.connection,
|
||||
collectionName: model.collectionName,
|
||||
attributes: attributes
|
||||
|
Loading…
x
Reference in New Issue
Block a user