Including operations links and events module

This commit is contained in:
Unknown committed 2019-02-28 17:08:57 +01:00
1 parent 522f6face0
commit 0427c24e70
5 files changed
+53 -6

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@ const operationsMenus = {
const allMenus = [
usersMenus,
teamsMenus,
// eventsMenus,
eventsMenus,
// financialBeingsMenus,
keyvaultMenus,
operationsMenus
+5 -1
View File
@@ -8,7 +8,7 @@ import jwksRsa from 'jwks-rsa'
import axios from 'axios'
import { createTransformedRemoteSchema } from './createRemoteSchema'
import { teams, events } from './links'
import { teams, events, operations } from './links'
import logger from './logger'
@@ -99,6 +99,10 @@ async function run () {
}
if (transformedOperationsSchema) {
schemas.push(transformedOperationsSchema)
if (transformedTeamsSchema) {
schemas.push(operations.linkSchemaDefs)
resolvers = Object.assign(resolvers, operations.resolver(transformedTeamsSchema))
}
}
if (transformedNotificationsSchema) {
schemas.push(transformedNotificationsSchema)
+3 -3
View File
@@ -132,12 +132,12 @@ export const resolver = (usersSchema, teamsSchema, operationsSchema) => ({
},
clone: {
fragment: `fragment CloneFragment on events_Participant{operationId}`,
resolve ({operationId : cloneIdList}, args, context, info) {
resolve ({operationId: cloneId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: operationsSchema,
operation: 'query',
fieldName: 'operations_GetClones',
args: { cloneIdList },
fieldName: 'operations_GetClone',
args: { cloneId },
context,
info
})
+2 -1
View File
@@ -1,4 +1,5 @@
import teams from './teams'
import events from './events'
import operations from './operations'
export { teams, events }
export { teams, events, operations }
+42
View File
@@ -0,0 +1,42 @@
export const linkSchemaDefs =
`
extend type operations_GetClones {
team: teams_Team
}
extend type operations_GetClones {
bot: teams_FinancialBeings
}
`
export const resolver = (teamsSchema) => ({
operations_GetClones: {
team: {
fragment: `fragment TeamFragment on operations_GetClones{teamId}`,
resolve ({teamId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_TeamById',
args: { teamId },
context,
info
})
}
},
bot: {
fragment: `fragment TeamFragment on operations_GetClones{botId}`,
resolve ({botId: fbId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_FbByFbId',
args: { fbId },
context,
info
})
}
}
}
})
export default { resolver, linkSchemaDefs }