Mutations are the conventional SDL schema type designated to represent a data modification query. They should be defined as class methods decorated with @Mutation().


The @Mutation() decorator supports parameters defined by the IMutationOptions interface.

Options Description Required
name The name of the mutation query in the SDL schema mutation type. If not specified, the name is assumed to be the method's name. No

Usage example

ID id
String name
String surname
insertUser(String name, String surname) : User
updateUser(ID id, String! name, String! surname) : User
deleteUser(ID id) : Boolean
import { Resolver, Mutation, Args } from '@pequehq/graphql';
import { UserService } from '../your/services';
import { User } from '../your/dto'

class ExampleResolver {
  constructor(private userService: UserService) {}

  async insertUser(@Args() args: Partial<User>): Promise<User> {
    return this.userService.insert({ name:, surname: args.surname });

  async updateUser(@Args() args: Partial<User>): Promise<User> {
    return this.userService.update(, { name:, surname: args.surname });

  async deleteUser(@Args() args: { id: string }): Promise<boolean> {
    return this.userService.delete(;