mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

feat(resolver.js)Support handleConnection for root query #632

Closed hank-cp closed 4 years ago

hank-cp commented 5 years ago

Support connection on root Query

type Query {
  users(
    first: Int
    after: String
    last: Int
    before: String
  ): UserConnection
}

or

    var userConnection = connectionDefinitions({name: 'User', nodeType: userType});

    schema = new GraphQLSchema({
      query: new GraphQLObjectType({
        name: 'RootQueryType',
        fields: {
          user: {
            type: userConnection.connectionType,
            args: connectionArgs,
            resolve: resolver(User)
          },
          node: nodeField
        }
      })
    })

Unit test included :)

codecov-io commented 5 years ago

Codecov Report

Merging #632 into master will increase coverage by 0.47%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #632      +/-   ##
=========================================
+ Coverage   91.33%   91.8%   +0.47%     
=========================================
  Files          13      13              
  Lines         427     415      -12     
=========================================
- Hits          390     381       -9     
+ Misses         37      34       -3
Impacted Files Coverage Δ
src/resolver.js 100% <100%> (+1.78%) :arrow_up:
src/typeMapper.js 97.29% <0%> (ø) :arrow_up:
src/relay.js 97.1% <0%> (+1.15%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5774259...39031c5. Read the comment docs.

hank-cp commented 5 years ago

Done, 1 more char triggers eslint warning...huuuu

hank-cp commented 5 years ago

This build failed looks not caused by my changes

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.