Lateworm
1/27/2018 - 5:16 PM

Boomtown GraphQL tests

Queries to be used in GraphiQL for testing the Boomtown server.

query getItems{ items{title}}

query itemById($id:ID){
  itemById(id: $id){
    id
    title
    itemowner {
      id
      fullname
    }
  }
}

query getUsers{users{fullname}}

query user($id:ID){
  user(id: $id){
    fullname
    bio
    shareditems {
			available
      borrower {
        id
      }
      description
      id
      imageurl
      itemowner {
        bio
        email
        fullname
        id
      }
      tags {
        id
        title
      }
      title
    }
  }
}

mutation addItem(
	$imageurl: String,
	$title: String,
	$description: String,
	$tags: [TagInput]
){
	addItem(
    newItem:
    {
			imageurl: $imageurl
			title: $title
			description: $description
			tags: $tags
		}
	){
  	imageurl
		title
    description
    tags {
      id
      title
    }
	}
}

# Query variables for the above

{
  "id": "7",
  "borrower": "TyHcYnSocuOg6PmWQivgxerTLcq2",
	"imageurl": "www.j-tull.com/aqualung.jpg",
	"title": "Aqualung",
	"description": "JT's best album",
	"tags": [
    {
    "id": 1,
    "title": "household items"
    }
  ]
}

# Test for new item submission

mutation addNewItem(
  $title: String
  $description: String
	$imageurl: String
  $itemowner: ID
  $tags:[TagInput]
){
  createNewItem(newItem:{
  title:$title
  description:$description
	imageurl:$imageurl
  itemowner:$itemowner
  tags:$tags
  }){
  	title
    description
    imageurl
    itemowner {
      id
    }
    tags {
      id
    }
  }
}

# Variables
{
  "title": "Awesome Title",
  "description": "Descriptive description.",
  "imageurl": "elgoogl.com",
  "itemowner": "5alo2au8ZzMiNRWOjz5nIZdjImn1",
  "tags": [
    {
      "id": 1
    },
    {
      "id": 2
    },
    {
      "id": 4
    }
  ]
}