Skip to content

Commit b4e6862

Browse files
committed
fix(graphql, #505): Less restrictive readResolverOpts for auto crud
1 parent c59f43a commit b4e6862

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/query-graphql/__tests__/module.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,21 @@ describe('NestjsQueryGraphQLModule', () => {
2424
expect(graphqlModule.providers).toHaveLength(3);
2525
expect(graphqlModule.exports).toHaveLength(4);
2626
});
27+
28+
it('should allow a defaultFilter for read options', () => {
29+
const graphqlModule = NestjsQueryGraphQLModule.forFeature({
30+
imports: [],
31+
resolvers: [
32+
{
33+
DTOClass: TestDTO,
34+
EntityClass: TestDTO,
35+
read: { defaultFilter: { name: { eq: 'foo' } } },
36+
},
37+
],
38+
});
39+
expect(graphqlModule.imports).toHaveLength(1);
40+
expect(graphqlModule.module).toBe(NestjsQueryGraphQLModule);
41+
expect(graphqlModule.providers).toHaveLength(3);
42+
expect(graphqlModule.exports).toHaveLength(4);
43+
});
2744
});

packages/query-graphql/src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface NestjsQueryGraphqlModuleOpts {
1212
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1313
assemblers?: Class<Assembler<any, any>>[];
1414
// eslint-disable-next-line @typescript-eslint/no-explicit-any
15-
resolvers: AutoResolverOpts<any, any, unknown, unknown, ReadResolverOpts<unknown>, PagingStrategies>[];
15+
resolvers: AutoResolverOpts<any, any, unknown, unknown, ReadResolverOpts<any>, PagingStrategies>[];
1616
pubSub?: Provider<GraphQLPubSub>;
1717
}
1818

0 commit comments

Comments
 (0)