Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] TypeORM hooks not being triggered with nestjs-query #380

Closed
GustavoLofrano opened this issue Jul 15, 2020 · 6 comments · Fixed by #386
Closed

[Bug] TypeORM hooks not being triggered with nestjs-query #380

GustavoLofrano opened this issue Jul 15, 2020 · 6 comments · Fixed by #386

Comments

@GustavoLofrano
Copy link

GustavoLofrano commented Jul 15, 2020

image

In UserEntity:

image

Don't hash the password in table:

image

without nestjs-query they work:
image

@doug-martin
Copy link
Owner

@GustavoLofrano I just tested this locally and it worked fine. If you can provide a repo I can try and help to diagnose the issue.

@GustavoLofrano
Copy link
Author

@GustavoLofrano
Copy link
Author

I think I found the problem.
is when using a class UserService, if commenting the code, will work.
I'm creating the Service class, in case I need it in the future, I'm standardizing.

it works

@Module({
  imports: [
    NestjsQueryGraphQLModule.forFeature({
      imports: [NestjsQueryTypeOrmModule.forFeature([UserEntity])],
      //services: [UserService],
      resolvers: [
        {
          EntityClass: UserEntity,
          //ServiceClass: UserService,
          DTOClass: UserDTO,
          CreateDTOClass: UserCreateDTO,
          UpdateDTOClass: UserUpdateDTO,
          pagingStrategy: PagingStrategies.CURSOR,
        },
      ],
    }),
  ],
})
export class UserModule {}

does not work

@Module({
  imports: [
    NestjsQueryGraphQLModule.forFeature({
      imports: [NestjsQueryTypeOrmModule.forFeature([UserEntity])],
      services: [UserService],
      resolvers: [
        {
          EntityClass: UserEntity,
          ServiceClass: UserService,
          DTOClass: UserDTO,
          CreateDTOClass: UserCreateDTO,
          UpdateDTOClass: UserUpdateDTO,
          pagingStrategy: PagingStrategies.CURSOR,
        },
      ],
    }),
  ],
})
export class UserModule {}

@doug-martin
Copy link
Owner

Thanks! I'll take a look later today.

@doug-martin
Copy link
Owner

@GustavoLofrano thanks again for the bug report and repo. I was able to reproduce and fix! If you update to version v0.17.2 it should work.

Let me know if you run into any additional issues.

@GustavoLofrano
Copy link
Author

@doug-martin. I'll use your package a lot. I'm starting a big project and the graphql base will be your package. The productivity gain that I will have is very good. Whenever I find something, I will try to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants