fix: adjustments based on seb's feedback

- remove eager from shipping_option relationship in `models/custom-shipping-options.ts`
- remove custom_shipping_options relation from cart model
This commit is contained in:
zakariaelas
2021-10-13 17:06:35 +01:00
parent 3d088c351b
commit dba1d5bb69
19 changed files with 424 additions and 139 deletions

View File

@@ -15,6 +15,9 @@ const {
Cart,
Return,
} = require("@medusajs/medusa")
const {
CustomShippingOption,
} = require("@medusajs/medusa/dist/models/custom-shipping-option")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
@@ -109,12 +112,6 @@ module.exports = async (connection, data = {}) => {
billing_address_id: "test-billing-address",
region_id: "test-region",
type: "swap",
custom_shipping_options: [
{
shipping_option_id: "test-option",
price: 0,
},
],
metadata: {
swap_id: "test-swap",
parent_order_id: orderWithSwap.id,
@@ -123,6 +120,13 @@ module.exports = async (connection, data = {}) => {
await manager.save(cartWithCustomSo)
manager.insert(CustomShippingOption, {
id: "cso-test",
cart_id: cartWithCustomSo.id,
price: 0,
shipping_option_id: "test-option",
})
const swapWithRMAMethod = manager.create(Swap, {
id: "test-swap-rma",
order_id: "order-with-swap",