Add expand to /admin/customers/:id (#1070)

* fix: 1055 add expand to /admin/customers/:id

* fix tests

* fix tests
This commit is contained in:
Oliver Windall Juhl
2022-02-25 18:53:49 +01:00
committed by olivermrbl
parent 1e4cc2fc80
commit 7c31acb064
6 changed files with 189 additions and 14 deletions
@@ -3,11 +3,23 @@ const { Customer, Address } = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
await manager.insert(Customer, {
const testAddr = await manager.create(Address, {
id: "test-address",
first_name: "Lebron",
last_name: "James",
})
await manager.save(testAddr)
const customer = await manager.create(Customer, {
id: "test-customer-1",
email: "test1@email.com",
})
customer.billing_address = testAddr
customer.shipping_addresses = [testAddr]
await manager.save(customer)
await manager.insert(Customer, {
id: "test-customer-2",
email: "test2@email.com",
@@ -23,11 +35,4 @@ module.exports = async (connection, data = {}) => {
email: "test4@email.com",
has_account: true,
})
await manager.insert(Address, {
id: "test-address",
first_name: "Lebron",
last_name: "James",
customer_id: "test-customer-1",
})
}