Skip to content

Commit

Permalink
fix(graphql, #505): Less restrictive readResolverOpts for auto crud
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-martin committed Sep 3, 2020
1 parent c59f43a commit 529d6f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/query-graphql/__tests__/module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,21 @@ describe('NestjsQueryGraphQLModule', () => {
expect(graphqlModule.providers).toHaveLength(3);
expect(graphqlModule.exports).toHaveLength(4);
});

it('should allow a defaultFilter for read options', () => {
const graphqlModule = NestjsQueryGraphQLModule.forFeature({
imports: [],
resolvers: [
{
DTOClass: TestDTO,
EntityClass: TestDTO,
read: { defaultFilter: { name: { eq: 'foo' } } },
},
],
});
expect(graphqlModule.imports).toHaveLength(1);
expect(graphqlModule.module).toBe(NestjsQueryGraphQLModule);
expect(graphqlModule.providers).toHaveLength(3);
expect(graphqlModule.exports).toHaveLength(4);
});
});
2 changes: 1 addition & 1 deletion packages/query-graphql/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface NestjsQueryGraphqlModuleOpts {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
assemblers?: Class<Assembler<any, any>>[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
resolvers: AutoResolverOpts<any, any, unknown, unknown, ReadResolverOpts<unknown>, PagingStrategies>[];
resolvers: AutoResolverOpts<any, any, unknown, unknown, ReadResolverOpts<any>, PagingStrategies>[];
pubSub?: Provider<GraphQLPubSub>;
}

Expand Down

0 comments on commit 529d6f8

Please sign in to comment.