File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 11/* @flow */
22/* eslint-disable */
33
4+ import type { TypeComposer } from 'graphql-compose' ;
45import type { connectionSortMapOpts as _connectionSortMapOpts } from 'graphql-compose-connection/lib/definition' ;
56export type connectionSortMapOpts = _connectionSortMapOpts ;
67
@@ -22,6 +23,7 @@ export type MonooseModelIndex = [
2223] ;
2324
2425export type MongooseModelT = {
26+ _gqcTypeComposer : TypeComposer ,
2527 modelName : string ,
2628 schema : MongooseModelSchemaT ,
2729 create ( doc : Object | Object [ ] ) : Promise < Object > ,
Original file line number Diff line number Diff line change @@ -126,6 +126,10 @@ export function convertModelToGraphQL(
126126 + '`name` argument should be non-empty string.' ) ;
127127 }
128128
129+ if ( model . _gqcTypeComposer ) {
130+ return model . _gqcTypeComposer ;
131+ }
132+
129133 const typeComposer = new TypeComposer (
130134 new GraphQLObjectType ( {
131135 name : typeName ,
@@ -135,6 +139,8 @@ export function convertModelToGraphQL(
135139 } )
136140 ) ;
137141
142+ model . _gqcTypeComposer = typeComposer ; // eslint-disable-line
143+
138144 const mongooseFields = getFieldsFromModel ( model , typeName ) ;
139145 const graphqlFields = { } ;
140146
You can’t perform that action at this time.
0 commit comments