自动清除类型为graphql的@Args

时间:2019-07-07 16:21:48

标签: type-graphql

是否可以自动清除args?

...
  @Mutation(returns => Ok)
  async signup(@Args() args: args.GetSignupArgs ) {
    sanitize(args);
    const { name, email, password } = args;
    const checkUser = await this.userRepository.findOne({ email })
...

1 个答案:

答案 0 :(得分:0)

您应该可以通过注入全局中间件来做到这一点。参见:https://github.com/19majkel94/type-graphql/blob/master/docs/middlewares.md