GraphQL Workshop 2

Customer Service

  1. Register new customer
mutation {
  registerUser(customer: {
      name: "Rakesh Kumar",
      email: "rakeshpersonal@gmail.com",
      address:"New Delhi, India",
      password: "test@123"
  }) {
    id,
    name,
    email
  }
}
  1. Login Registered User
mutation {
  login(customer: {
      email: "test@gmail.com",
      password:"test@123"
    })
}
  1. Get customers list
query {
  customers {
    name,
    id,
    email,
    address
  }
}
  1. Get specific customer detail
query {
  ccustomer(id: "5ee4a83a6c001022ee618ea2") {
    name,
    email,
  }
}

Product Service

  1. Create new product
mutation {
  createNewProduct(product: {
      name: "iPhone",
      price: 100000,
      category: "mobile"
    }) {
    name,
    id,
    price,
    category
  }
}
  1. Fetch list of products
query {
  products {
    category,
    price,
    name,
    id
  }
}

Order Service

  1. Create new Order
mutation {
  createNewOrder(order: {
    customerId: "5ee64df4dd50282d331f50eb",
    totalOrderValue: 12000,
    shippingAddress: "Gurgaon",
    paymentMethod: "COD",
    products: [
      {
        productId: "5ee64e874f446934492e1389",
        quantity: 100,
        price: 12344
      },
      {
        productId: "5ee64e684f446934492e1388",
        quantity: 200,
        price: 543112
      }
    ]
    
  }) {
    id,
    customerId,
    totalOrderValue,
    shippingAddress,
    paymentMethod,
    products {
      productId
      quantity,
      price,
    }
  }
}
  1. Fetch list of orders
query {
  orders {
    shippingAddress,
    totalOrderValue,
    paymentMethod
    products {
      product {
        name,
        category,
        price
      }
      quantity,
      price
    }
    customer {
      name,
      email
    }
  }
}