Logo
NeoArc Studio
Query

customerOrders

Retrieves all orders for a specific customer, optionally filtered by status. Useful for order history views.

Tags: orders, customers, history

Signature

query { customerOrders(customerId: ID!, status: OrderStatus, first: Int): [Order!]! }

Arguments

Name Type Required Description
customerId ID! Yes The unique identifier of the customer
status OrderStatus No Optional filter by order status
first Int No Number of orders to return

Return Type

[Order!]!

Complexity: 3

Examples

Query

query GetCustomerOrders($customerId: ID!, $status: OrderStatus, $first: Int) {
  customerOrders(customerId: $customerId, status: $status, first: $first) {
    id
    status
    totalAmount
    itemCount
    createdAt
  }
}

Variables

{
  "customerId": "cust_xyz789",
  "status": "DELIVERED",
  "first": 5
}

Response

{
  "data": {
    "customerOrders": [
      {
        "id": "order_abc123",
        "status": "DELIVERED",
        "totalAmount": "367.16",
        "itemCount": 2,
        "createdAt": "2024-06-20T10:00:00Z"
      },
      {
        "id": "order_def456",
        "status": "DELIVERED",
        "totalAmount": "89.99",
        "itemCount": 1,
        "createdAt": "2024-05-15T14:30:00Z"
      }
    ]
  }
}