ZhuangER
9/9/2018 - 3:12 AM

graphql namespace schema example

graphql namespace schema example

type UserMutation {
  create(data: CreateUserInput): User
  update(where: WhereUserInput, data: UpdateUserInput): User
  delete(where: WhereUserInput): User
}

type ItemMutation {
  create(data: CreateItemInput): Item
  update(where: WhereItemInput, data: UpdateItemInput): Item
  delete(where: WhereItemInput): Item
}

mutation {
  userMutation: UserMutation
  itemMutation: ItemMutation
}
module.exports = {
  UserMutation {
    create() {
      ...
    }
    update() {
      ...
    }
    delete() {
      ...
    }
  },
      
  ItemMutation: {
    create() {
      ...
    }
    update() {
      ...
    }
    delete() {
      ...
    }
  },
  
  Mutation: {
    userMutation() {
      return {};
    },
    itemMutation() {
      return {};
    }
  }
}