Adding the cockpit to the masterApp
This commit is contained in:
1 parent
df20196b2b
commit
edcda1a680
2 files changed
+44
-3
No files matched your search
+9
-2
@@ -78,6 +78,10 @@ async function run () {
|
||||
'strategizer_',
|
||||
process.env.STRATEGIZER_API_URL,
|
||||
process.env.STRATEGIZER_API_PRESHARED)
|
||||
const transformeCockpitSchema = await createTransformedRemoteSchema(
|
||||
'cockpit_',
|
||||
process.env.COCKPIT_API_URL,
|
||||
process.env.COCKPIT_API_PRESHARED)
|
||||
|
||||
var schemas = []
|
||||
var resolvers = {}
|
||||
@@ -107,9 +111,9 @@ async function run () {
|
||||
}
|
||||
if (transformedOperationsSchema) {
|
||||
schemas.push(transformedOperationsSchema)
|
||||
if (transformedTeamsSchema) {
|
||||
if (transformedTeamsSchema && transformeCockpitSchema) {
|
||||
schemas.push(operations.linkSchemaDefs)
|
||||
resolvers = Object.assign(resolvers, operations.resolver(transformedTeamsSchema))
|
||||
resolvers = Object.assign(resolvers, operations.resolver(transformedTeamsSchema, transformeCockpitSchema))
|
||||
}
|
||||
}
|
||||
if (transformedNotificationsSchema) {
|
||||
@@ -121,6 +125,9 @@ async function run () {
|
||||
if (transformeStrategizerSchema) {
|
||||
schemas.push(transformeStrategizerSchema)
|
||||
}
|
||||
if (transformeCockpitSchema) {
|
||||
schemas.push(transformeCockpitSchema)
|
||||
}
|
||||
|
||||
const schema = mergeSchemas({
|
||||
schemas,
|
||||
|
||||
@@ -6,9 +6,43 @@ export const linkSchemaDefs =
|
||||
extend type operations_GetClones {
|
||||
bot: teams_FinancialBeings
|
||||
}
|
||||
extend type operations_Clone {
|
||||
orders( state: cockpit_OrderStateEnum ): [cockpit_Order]
|
||||
}
|
||||
extend type operations_Clone {
|
||||
signals( state: cockpit_SignalStateEnum ): [cockpit_Signal]
|
||||
}
|
||||
`
|
||||
|
||||
export const resolver = (teamsSchema) => ({
|
||||
export const resolver = (teamsSchema, cockpitSchema) => ({
|
||||
operations_Clone: {
|
||||
orders: {
|
||||
fragment: `fragment OrderFragment on operations_Clone{id}`,
|
||||
resolve ({id: cloneId}, args, context, info) {
|
||||
return info.mergeInfo.delegateToSchema({
|
||||
schema: cockpitSchema,
|
||||
operation: 'query',
|
||||
fieldName: 'cockpit_OrdersByClondeId',
|
||||
args: { ...args, cloneId },
|
||||
context,
|
||||
info
|
||||
})
|
||||
}
|
||||
},
|
||||
signals: {
|
||||
fragment: `fragment SignalFragment on operations_Clone{id}`,
|
||||
resolve ({id: cloneId}, args, context, info) {
|
||||
return info.mergeInfo.delegateToSchema({
|
||||
schema: cockpitSchema,
|
||||
operation: 'query',
|
||||
fieldName: 'cockpit_SignalsByClondeId',
|
||||
args: { ...args, cloneId },
|
||||
context,
|
||||
info
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
operations_GetClones: {
|
||||
team: {
|
||||
fragment: `fragment TeamFragment on operations_GetClones{teamId}`,
|
||||
|
||||
Reference in new issue
Block a user