Skip to content

ashutoshsahoo/order-service

Repository files navigation

Order Service

Signup

mutation($request: SignupRequest!) {
  signup(request: $request) {
    username
    email
    roles
  }
}

and query variable

{
  "request": {
    "username": "ashutosh",
    "password": "ashu@123",
    "email": "ashu@email.com"
  }
}

Signin

mutation($request: LoginRequest!){
  login(request: $request){
    token
    username
    roles
  }
}

and query variable

{
  "request": {
    "username": "ashutosh",
    "password": "ashu@123"
  }
}

Use the response token to add into Authorization header for all the following requests.

Create product

mutation($product: ProductInput!) {
  createProduct(product: $product) {
    id
    name
  }
}

and query variable

{
  "product": {
    "id": "1",
    "name": "samsung tv",
    "description": "Its a good tv",
    "price": "20000"
  }
}

Query product by id

query {
  productById(id: "1") {
    id
    name
  }
}

Query customer by id

query {
  customerById(id: "1") {
    id
    name
    orders {
      quantity
      id
      product {
        id
        name
      }
    }
  }
}

Create order

mutation($order: CreateOrderInput!) {
  createOrder(order: $order) {
    id
    customer {
      name
    }
    product {
      name
      description
      price
    }
    quantity
    status
  }
}

and query variable

{
  "order": {
   "customerId": "1",
    "productId": "1",
    "quantity": 3
  }
}