01 Software

Mutations

GraphQL Mutations - create, update, delete, authentication

Mutations

Create

mutation {
  createProduct(data: {
    name: "New Product"
    price: 15000
    status: draft
    tenant: "tenant_id"
  }) {
    id
    name
    price
    status
  }
}

Update

mutation {
  updateProduct(
    id: "product_id"
    data: {
      price: 12000
      status: published
    }
  ) {
    id
    name
    price
    status
  }
}

Delete

mutation {
  deleteProduct(id: "product_id") {
    id
    name
  }
}

Authentication Mutations

Login

mutation {
  loginUser(
    email: "user@example.com"
    password: "password"
  ) {
    token
    user {
      id
      email
      role
      tenants {
        id
        name
      }
    }
    exp
  }
}

Logout

mutation {
  logoutUser
}

Current User

query {
  meUser {
    user {
      id
      email
      role
      tenants {
        id
        name
        plan
      }
    }
  }
}

On this page