66} from \' graphql\' ;
77import { globalIdField } from \' graphql-relay\' ;
88
9+ import { NodeInterface } from \' ../interface/NodeInterface\' ;
10+
911export default new GraphQLObjectType({
1012 name : \' Example\' ,
1113 description : \' Represents Example\' ,
@@ -16,6 +18,7 @@ export default new GraphQLObjectType({
1618 description: \' My example field\' ,
1719 resolve : obj => obj .example ,
1820 },
21+ interfaces : () => [NodeInterface ],
1922 }),
2023});" ,
2124 " typeTest" : " import { graphql } from \' graphql\' ;
@@ -62,10 +65,13 @@ Object {
6265import {
6366 GraphQLObjectType ,
6467 GraphQLString ,
65- GraphQLID ,
6668} from \' graphql\' ;
6769import { globalIdField } from \' graphql-relay\' ;
6870
71+ import { NodeInterface } from \' ../interface/NodeInterface\' ;
72+ import UserType from \' ./UserType\' ;
73+ import UserLoader from \' ../loader/UserLoader\' ;
74+
6975export default new GraphQLObjectType ({
7076 name: \' Post\' ,
7177 description : \' Represents Post\' ,
@@ -77,9 +83,9 @@ export default new GraphQLObjectType({
7783 resolve : obj => obj .title ,
7884 },
7985 user : {
80- type: GraphQLID ,
86+ type: UserType ,
8187 description: \' User that created this post\' ,
82- resolve : obj => obj .user ,
88+ resolve : async ( obj , args , { user }) => await UserLoader . load ( user , obj .user ) ,
8389 },
8490 slug : {
8591 type: GraphQLString ,
@@ -96,6 +102,7 @@ export default new GraphQLObjectType({
96102 description: \' \' ,
97103 resolve : obj => obj .updatedAt .toISOString (),
98104 },
105+ interfaces : () => [NodeInterface ],
99106 }),
100107});
101108" ,
@@ -147,6 +154,8 @@ import {
147154} from \' graphql\' ;
148155import { globalIdField } from \' graphql-relay\' ;
149156
157+ import { NodeInterface } from \' ../interface/NodeInterface\' ;
158+
150159export default new GraphQLObjectType ({
151160 name: \' User\' ,
152161 description : \' Represents User\' ,
@@ -172,6 +181,7 @@ export default new GraphQLObjectType({
172181 description: \' \' ,
173182 resolve : obj => obj .active ,
174183 },
184+ interfaces : () => [NodeInterface ],
175185 }),
176186});
177187" ,
0 commit comments