Feat(medusa): search orders by customer phone and name (#2913)

* add support for customer first- and last names and phone

* test for querying customer first_name, last_name and phone

* add customer as prop for querying orders

* polishing before pr

* changeset
This commit is contained in:
Philip Korsholm
2022-12-29 15:20:18 +01:00
committed by GitHub
parent 726858d847
commit 645e0d0ec5
4 changed files with 93 additions and 0 deletions
+4
View File
@@ -220,6 +220,7 @@ class OrderService extends TransactionBaseService {
alias: "order",
innerJoin: {
shipping_address: "order.shipping_address",
customer: "order.customer",
},
}
@@ -233,6 +234,9 @@ class OrderService extends TransactionBaseService {
})
.orWhere(`order.email ILIKE :q`, { q: `%${q}%` })
.orWhere(`display_id::varchar(255) ILIKE :dId`, { dId: `${q}` })
.orWhere(`customer.first_name ILIKE :q`, { q: `%${q}%` })
.orWhere(`customer.last_name ILIKE :q`, { q: `%${q}%` })
.orWhere(`customer.phone ILIKE :q`, { q: `%${q}%` })
})
)
}