mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 06:35:47 +00:00
Add kind in bootstrap and relations can only be created with collection types
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
57122c4acb
commit
88a5a0a654
@ -2,14 +2,14 @@
|
||||
|
||||
const yup = require('yup');
|
||||
const { validators, isValidName } = require('./common');
|
||||
const { typeKinds } = require('./constants');
|
||||
|
||||
const REVERSE_RELATIONS = ['oneToOne', 'oneToMany', 'manyToOne', 'manyToMany'];
|
||||
|
||||
module.exports = (obj, validNatures) => {
|
||||
const contentTypesUIDs = Object.keys(strapi.contentTypes).concat([
|
||||
'__self__',
|
||||
'__contentType__',
|
||||
]);
|
||||
const contentTypesUIDs = Object.keys(strapi.contentTypes)
|
||||
.filter(key => strapi.contentTypes[key].kind === typeKinds.COLLECTION_TYPE)
|
||||
.concat(['__self__', '__contentType__']);
|
||||
|
||||
return {
|
||||
target: yup
|
||||
|
||||
3
packages/strapi/lib/core/bootstrap.js
vendored
3
packages/strapi/lib/core/bootstrap.js
vendored
@ -79,6 +79,7 @@ module.exports = function(strapi) {
|
||||
uid: `application::${apiName}.${modelName}`,
|
||||
apiName,
|
||||
modelName,
|
||||
kind: model.kind || 'collectionType',
|
||||
globalId: model.globalId || _.upperFirst(_.camelCase(modelName)),
|
||||
collectionName:
|
||||
model.collectionName || `${modelName}`.toLocaleLowerCase(),
|
||||
@ -157,6 +158,7 @@ module.exports = function(strapi) {
|
||||
Object.assign(model, {
|
||||
__schema__: pickSchema(model),
|
||||
modelType: 'contentType',
|
||||
kind: model.kind || 'collectionType',
|
||||
uid: `strapi::${key}`,
|
||||
plugin: 'admin',
|
||||
modelName: key,
|
||||
@ -192,6 +194,7 @@ module.exports = function(strapi) {
|
||||
Object.assign(model, {
|
||||
__schema__: pickSchema(model),
|
||||
modelType: 'contentType',
|
||||
kind: model.kind || 'collectionType',
|
||||
modelName: key,
|
||||
uid: `plugins::${pluginName}.${key}`,
|
||||
plugin: pluginName,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user