Skip to content

Commit fe0cfb1

Browse files
committed
fix: update order query
1 parent 86b3f85 commit fe0cfb1

File tree

1 file changed

+4
-34
lines changed
  • starters/nextjs/firebase-ecommerce/dataconnect/connector

1 file changed

+4
-34
lines changed

starters/nextjs/firebase-ecommerce/dataconnect/connector/queries.gql

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -200,41 +200,10 @@ query SearchProductReviewContentUsingL2Similarity($query: String!) @auth(level:
200200

201201
# Get the orders of a customer by ID, admin access only
202202
query GetOrdersByCustomerId($customerId: String!) @auth(level: USER) {
203-
orders(where: { customer: { id: { eq: $customerId } } }) {
204-
id
205-
customerId @check(expr: "this == auth.uid", message: "You may only see your own orders.")
206-
processedAt
207-
chargeId
208-
paymentIntentId
209-
receiptUrl
210-
subtotalPrice
211-
totalPrice
212-
financialStatus
213-
fulfillmentStatus
214-
orderItems_on_order {
215-
id
216-
quantity
217-
price
218-
product {
219-
id
220-
title
221-
handle
222-
productImages_on_product(orderBy: [{ displayPosition: ASC }], limit: 1) {
223-
url
224-
altText
225-
width
226-
height
227-
}
228-
}
229-
}
230-
}
231-
}
232-
233-
# Get the orders of the current logged in customer
234-
query GetCurrentCustomerOrders @auth(level: USER) {
235-
orders: customer(key: { id_expr: "auth.uid" }) {
203+
orders: customer(id: $customerId) {
236204
orders_on_customer {
237205
id
206+
customerId @check(expr: "this == auth.uid", message: "You may only see your own orders.")
238207
processedAt
239208
chargeId
240209
paymentIntentId
@@ -267,7 +236,8 @@ query GetCurrentCustomerOrders @auth(level: USER) {
267236
query GetOrderById($id: UUID!) @auth(level: USER) {
268237
order(id: $id) {
269238
id
270-
customerId @check(expr: "this == auth.uid", message: "Customers can only view orders they placed.")
239+
customerId
240+
@check(expr: "this == auth.uid", message: "Customers can only view orders they placed.")
271241
processedAt
272242
receiptUrl
273243
totalPrice

0 commit comments

Comments
 (0)