import { GraphQLServer } from 'graphql-yoga' ; import { prisma } from './generated/prisma-client' ; import { Query } from './resolvers/query' ; import { Subscription } from './resolvers/subscription' ; import { Selectors } from './types' ; const resolvers = { Subscription , Query , BlockNumber : { authoredBy ( parent ) { return prisma . blockNumber ( { id : parent . id } ) . authoredBy ( ) ; } , hash ( parent ) { return prisma . blockNumber ( { id : parent . id } ) . hash ( ) ; } , id ( parent ) { return prisma . blockNumber ( { id : parent . id } ) . id ( ) ; } , number ( parent ) { return prisma . blockNumber ( { id : parent . id } ) . number ( ) ; } , startDateTime ( parent ) { return prisma . blockNumber ( { id : parent . id } ) . startDateTime ( ) ; } , } , Era : { eraStartSessionIndex ( parent ) { return prisma . era ( { id : parent . id } ) . eraStartSessionIndex ( ) ; } , } , HeartBeat : { sessionIndex ( parent ) { return prisma . heartBeat ( { id : parent . id } ) . sessionIndex ( ) ; } , } , Nomination : { session ( parent ) { return prisma . nomination ( { id : parent . id } ) . session ( ) ; } , } , OfflineValidator : { sessionIndex ( parent ) { return prisma . offlineValidator ( { id : parent . id } ) . sessionIndex ( ) ; } , } , Reward : { authoredBlock ( parent ) { return prisma . reward ( { id : parent . id } ) . authoredBlock ( ) ; } , sessionIndex ( parent ) { return prisma . reward ( { id : parent . id } ) . sessionIndex ( ) ; } , } , Session : { id ( parent ) { return prisma . session ( { id : parent . id } ) . id ( ) ; } , index ( parent ) { return prisma . session ( { id : parent . id } ) . index ( ) ; } , start ( parent ) { return prisma . session ( { id : parent . id } ) . start ( ) ; } , } , Stake : { blockNumber ( parent ) { return prisma . stake ( { id : parent . id } ) . blockNumber ( ) ; } , } , TotalIssuance : { blockNumber ( parent ) { return prisma . totalIssuance ( { id : parent . id } ) . blockNumber ( ) ; } , } , Validator : { session ( parent ) { return prisma . validator ( { id : parent . id } ) . session ( ) ; } , } , Council : { blockNumber ( parent ) { return prisma . council ( { id : parent . id } ) . blockNumber ( ) ; } , members ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . council ( { id : parent . id } ) . members ( { where , orderBy , skip , after , before , first , last } ) ; } , } , CouncilMember : { councils ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . councilMember ( { id : parent . id } ) . councils ( { where , orderBy , skip , after , before , first , last } ) ; } , } , Motion : { motionProposalArguments ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . motion ( { id : parent . id } ) . motionProposalArguments ( { where , orderBy , skip , after , before , first , last , } ) ; } , motionStatus ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . motion ( { id : parent . id } ) . motionStatus ( { where , orderBy , skip , after , before , first , last } ) ; } , preimage ( parent ) { return prisma . motion ( { id : parent . id } ) . preimage ( ) ; } , treasurySpendProposal ( parent ) { return prisma . motion ( { id : parent . id } ) . treasurySpendProposal ( ) ; } , } , MotionStatus : { blockNumber ( parent ) { return prisma . motionStatus ( { id : parent . id } ) . blockNumber ( ) ; } , } , Proposal : { preimage ( parent ) { return prisma . proposal ( { id : parent . id } ) . preimage ( ) ; } , proposalStatus ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . proposal ( { id : parent . id } ) . proposalStatus ( { where , orderBy , skip , after , before , first , last } ) ; } , } , Preimage : { preimageArguments ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . preimage ( { id : parent . id } ) . preimageArguments ( { where , orderBy , skip , after , before , first , last , } ) ; } , preimageStatus ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . preimage ( { id : parent . id } ) . preimageStatus ( { where , orderBy , skip , after , before , first , last } ) ; } , } , PreimageStatus : { blockNumber ( parent ) { return prisma . preimageStatus ( { id : parent . id } ) . blockNumber ( ) ; } , } , ProposalStatus : { blockNumber ( parent ) { return prisma . proposalStatus ( { id : parent . id } ) . blockNumber ( ) ; } , } , TreasurySpendProposal : { treasuryStatus ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . treasurySpendProposal ( { id : parent . id } ) . treasuryStatus ( { where , orderBy , skip , after , before , first , last } ) ; } , motion ( parent ) { return prisma . treasurySpendProposal ( { id : parent . id } ) . motion ( ) ; } , } , TreasuryStatus : { blockNumber ( parent ) { return prisma . treasuryStatus ( { id : parent . id } ) . blockNumber ( ) ; } , } , Referendum : { preimage ( parent ) { return prisma . referendum ( { id : parent . id } ) . preimage ( ) ; } , referendumStatus ( parent , { where , orderBy , skip , after , before , first , last } ) { return prisma . referendum ( { id : parent . id } ) . referendumStatus ( { where , orderBy , skip , after , before , first , last } ) ; } , } , ReferendumStatus : { blockNumber ( parent ) { return prisma . referendumStatus ( { id : parent . id } ) . blockNumber ( ) ; } , } , } ; const server = new GraphQLServer ( { typeDefs : './src/schema.graphql' , resolvers , context : { prisma } , } ) ; server . start ( ( ) => console . log ( 'Server is running on http://localhost:4000' ) ) ;