How to use the type-graphql.Args function in type-graphql

To help you get started, we’ve selected a few type-graphql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wemaintain / auto-relay / packages / core / src / services / relay-query.service.ts View on Github external
protected registerArgs(target: Object, propertyKey: string, options?: RelayedQueryOptions,) {
    const ConnectionArgsThunk = Container.get(CONNECTIONARGS_OBJECT);
    const ConnectionArgs = ConnectionArgsThunk();

    if (options && options.paginationInputType) {
      // We want our pagination to be a named input rather than args
      const name = typeof options.paginationInputType === 'string' ? options.paginationInputType : 'pagination';
      Reflect.defineMetadata('autorelay:connectionArgs:key', name, target, propertyKey)
      Arg(name, () => ConnectionArgs, { nullable: true })(target, propertyKey, 99999999);
    } else {
      Args(() => ConnectionArgs)(target, propertyKey, 99999999);
    }
  }
}