feat: Application types generation from project GQL schema's (#8995)
This commit is contained in:
+18
-1
@@ -15,14 +15,31 @@ moduleIntegrationTestRunner<IStockLocationService>({
|
||||
service: StockLocationModuleService,
|
||||
}).linkable
|
||||
|
||||
expect(Object.keys(linkable)).toEqual(["stockLocation"])
|
||||
expect(Object.keys(linkable)).toEqual([
|
||||
"stockLocationAddress",
|
||||
"stockLocation",
|
||||
])
|
||||
|
||||
Object.keys(linkable).forEach((key) => {
|
||||
delete linkable[key].toJSON
|
||||
})
|
||||
|
||||
expect(linkable).toEqual({
|
||||
stockLocationAddress: {
|
||||
id: {
|
||||
linkable: "stock_location_address_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "stockLocationService",
|
||||
field: "stockLocationAddress",
|
||||
},
|
||||
},
|
||||
stockLocation: {
|
||||
id: {
|
||||
field: "stockLocation",
|
||||
linkable: "stock_location_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "stockLocationService",
|
||||
},
|
||||
location_id: {
|
||||
linkable: "location_id",
|
||||
primaryKey: "location_id",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { defineJoinerConfig, Modules } from "@medusajs/utils"
|
||||
import { StockLocation } from "./models"
|
||||
import { default as schema } from "./schema"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.STOCK_LOCATION, {
|
||||
schema,
|
||||
linkableKeys: {
|
||||
stock_location_id: StockLocation.name,
|
||||
location_id: StockLocation.name,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
export default `
|
||||
type StockLocationAddress {
|
||||
id: ID
|
||||
address_1: String!
|
||||
address_2: String
|
||||
company: String
|
||||
country_code: String!
|
||||
city: String
|
||||
phone: String
|
||||
postal_code: String
|
||||
province: String
|
||||
metadata: JSON
|
||||
created_at: DateTime!
|
||||
updated_at: DateTime!
|
||||
deleted_at: DateTime
|
||||
}
|
||||
|
||||
type StockLocation {
|
||||
id: ID!
|
||||
name: String!
|
||||
metadata: JSON
|
||||
address_id: ID!
|
||||
address: StockLocationAddress
|
||||
created_at: DateTime!
|
||||
updated_at: DateTime!
|
||||
deleted_at: DateTime
|
||||
}
|
||||
|
||||
`
|
||||
Reference in New Issue
Block a user