Merge branch 'master' of github.com:payloadcms/payload
This commit is contained in:
@@ -241,12 +241,16 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
|
||||
let localeSchema: { [key: string]: any } = {};
|
||||
|
||||
if (hasManyRelations) {
|
||||
localeSchema._id = false;
|
||||
localeSchema.value = {
|
||||
localeSchema = {
|
||||
...formatBaseSchema(field, buildSchemaOptions),
|
||||
type: Schema.Types.Mixed,
|
||||
refPath: `${field.name}.${locale}.relationTo`,
|
||||
_id: false,
|
||||
value: {
|
||||
type: Schema.Types.Mixed,
|
||||
refPath: `${field.name}.${locale}.relationTo`,
|
||||
},
|
||||
relationTo: { type: String, enum: field.relationTo },
|
||||
};
|
||||
localeSchema.relationTo = { type: String, enum: field.relationTo };
|
||||
} else {
|
||||
localeSchema = {
|
||||
...formatBaseSchema(field, buildSchemaOptions),
|
||||
@@ -263,12 +267,16 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
|
||||
localized: true,
|
||||
};
|
||||
} else if (hasManyRelations) {
|
||||
schemaToReturn._id = false;
|
||||
schemaToReturn.value = {
|
||||
schemaToReturn = {
|
||||
...formatBaseSchema(field, buildSchemaOptions),
|
||||
type: Schema.Types.Mixed,
|
||||
refPath: `${field.name}.relationTo`,
|
||||
_id: false,
|
||||
value: {
|
||||
type: Schema.Types.Mixed,
|
||||
refPath: `${field.name}.relationTo`,
|
||||
},
|
||||
relationTo: { type: String, enum: field.relationTo },
|
||||
};
|
||||
schemaToReturn.relationTo = { type: String, enum: field.relationTo };
|
||||
|
||||
if (field.hasMany) {
|
||||
schemaToReturn = {
|
||||
|
||||
Reference in New Issue
Block a user