|
|
@@ -61,16 +61,6 @@ export function addGraphQLCustomFields(
|
|
|
customFields: ${entityName}CustomFields
|
|
|
}
|
|
|
`;
|
|
|
-
|
|
|
- // For custom fields on the Address entity, we also extend the OrderAddress
|
|
|
- // type (which is used to store address snapshots on Orders)
|
|
|
- if (entityName === 'Address' && schema.getType('OrderAddress')) {
|
|
|
- customFieldTypeDefs += `
|
|
|
- extend type OrderAddress {
|
|
|
- customFields: ${entityName}CustomFields
|
|
|
- }
|
|
|
- `;
|
|
|
- }
|
|
|
} else {
|
|
|
customFieldTypeDefs += `
|
|
|
extend type ${entityName} {
|
|
|
@@ -178,6 +168,24 @@ export function addGraphQLCustomFields(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (customFieldConfig.Address?.length) {
|
|
|
+ // For custom fields on the Address entity, we also extend the OrderAddress
|
|
|
+ // type (which is used to store address snapshots on Orders)
|
|
|
+ if (schema.getType('OrderAddress')) {
|
|
|
+ customFieldTypeDefs += `
|
|
|
+ extend type OrderAddress {
|
|
|
+ customFields: AddressCustomFields
|
|
|
+ }
|
|
|
+ `;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ customFieldTypeDefs += `
|
|
|
+ extend type OrderAddress {
|
|
|
+ customFields: JSON
|
|
|
+ }
|
|
|
+ `;
|
|
|
+ }
|
|
|
+
|
|
|
return extendSchema(schema, parse(customFieldTypeDefs));
|
|
|
}
|
|
|
|