rogerballard / nestjs-relay

A batteries-included toolkit for building Relay-compliant GraphQL APIs with NestJS v7
MIT License
60 stars 14 forks source link

feat: add async mutation support #173

Closed PaulBrachmann closed 3 years ago

PaulBrachmann commented 3 years ago

This PR enables support for RelayMutations to be async (meaning they can return a Promise). Currently, such mutations lead to null returns.

E.g., mutations such as these resolve properly with the proposed changes:

  @RelayMutation(() => DeleteUserPayload)
  async deleteUser(@InputArg(() => DeleteUserInput) input: DeleteUserInput) {
    await this.usersService.remove(input.id.toString());
    return new DeleteUserPayload(input.id);
  }
leesiongchan commented 3 years ago

Kinda bummer without async support! This could be super useful!

rogerballard commented 3 years ago

Hey @PaulBrachmann thanks for your submission. I completely agree that async functionality would be really useful here.

I will look at getting this PR merged once I have fixed the development workflow.