TriPSs/nestjs-query

Nest can't resolve dependencies of the MarkdownActivityAuthorizerInterceptor

Closed this issue · 2 comments

Describe the bug
A clear and concise description of what the bug is.

Have you read the Contributing Guidelines?

Yes

To Reproduce
Steps to reproduce the behavior:

  1. clone the small reproducible demo repository: https://github.com/xin-ze/nestjs_reproduction/tree/main
  2. select 'main' branch
  3. refer to README.md and execute the code, will encounter an error: nestjs cannot find the generated AuthorizerProviders

Expected behavior
This error disappears

Screenshots
image

code path: apps/content/src/app/markdown/markdown.module.ts
image

Desktop (please complete the following information):

  • Node Version: 18.16.0
  • Nestjs-query Version v5.0.0

Please follow the docs.

You need to change the module to look more like this:

@Module({
  exports: [],
  imports: [
    NestjsQueryGraphQLModule.forFeature({
      imports: [TypeOrmModule.forFeature([MarkdownActivity])],
      services: [MarkdownActivityService],
      resolvers: [
        {
          DTOClass: YourDTO,
          EntityClass: MarkdownActivity,
        },
      ],
    }),
  ],
  providers: [
    MarkdownActivityResolver,
  ],
})
export class MarkdownModule {}

@TriPSs Thank you! I have one more question: do I have to declare a DTO class? There is no such concept in the demo code. After rewriting it like this, the error is still reported.

image image

The demo code has been updated and you should be able to reproduce it locally.