I have 2 classes that extends RESTDataSource to consume differente API services. And I want to join the information of each other. Below I have index.ts:
(async (typeDefs: any, resolvers: any) => {
const app = express()
const httpServer = http.createServer(app)
const server = new ApolloServer({
typeDefs,
resolvers,
csrfPrevention: true,
cache: 'bounded',
plugins: [ApolloServerPluginDrainHttpServer({ httpServer }),],
dataSources: () => {
return {
icpAPI: new IcpAPI(),
agendamentoAPI: new AgendamentoAPI()
}
},
});
await server.start()
server.applyMiddleware({ app })
await new Promise<void>((resolve) => httpServer.listen({ port: PORT }, resolve))
})(Schema, Resolvers)
Schema Index.ts
import { gql } from 'apollo-server-express'
import ItemPedidoEcommerce from './item-pedido-ecommerce'
import Parceiro from './parceiro'
import Agendamento from './agendamento'
import Pedido from './pedido'
import Vendedor from './vendedor'
import Status from './status'
const Schema = gql`
${ItemPedidoEcommerce}
${Pedido}
${Status}
${Agendamento}
${Parceiro}
${Vendedor}
extend type Parceiro {
vendedor: Vendedor
}
extend type Pedido {
status: Status,
parceiro: Parceiro
}
extend type ItemPedidoEcommerce {
pedido: Pedido,
agendamento: Agendamento,
parceiro: Parceiro,
}
type Query {
pedidoGARECommerce(id: String): ItemPedidoEcommerce
pedidoGAR(id: Int): Pedido
agendamento(id: Int): Agendamento
codRev(id: Int): Parceiro
}
`
export default Schema
how could I do that?