chore(core-flows): adjust inventory when return is received (#8222)
This commit is contained in:
1 parent
f38f6d53b4
commit
7a5349c0ae
20 files changed
+398
-105
No files matched your search
@@ -1,4 +1,9 @@
|
|||||||
import { ModuleRegistrationName, RuleOperator } from "@medusajs/utils"
|
import {
|
||||||
|
ContainerRegistrationKeys,
|
||||||
|
ModuleRegistrationName,
|
||||||
|
Modules,
|
||||||
|
RuleOperator,
|
||||||
|
} from "@medusajs/utils"
|
||||||
import { medusaIntegrationTestRunner } from "medusa-test-utils"
|
import { medusaIntegrationTestRunner } from "medusa-test-utils"
|
||||||
import {
|
import {
|
||||||
adminHeaders,
|
adminHeaders,
|
||||||
@@ -14,11 +19,35 @@ medusaIntegrationTestRunner({
|
|||||||
let shippingProfile
|
let shippingProfile
|
||||||
let fulfillmentSet
|
let fulfillmentSet
|
||||||
let returnReason
|
let returnReason
|
||||||
|
let inventoryItem
|
||||||
|
let location
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const container = getContainer()
|
const container = getContainer()
|
||||||
await createAdminUser(dbConnection, adminHeaders, container)
|
await createAdminUser(dbConnection, adminHeaders, container)
|
||||||
|
|
||||||
|
const product = (
|
||||||
|
await api.post(
|
||||||
|
"/admin/products",
|
||||||
|
{
|
||||||
|
title: "Test product",
|
||||||
|
variants: [
|
||||||
|
{
|
||||||
|
title: "Test variant",
|
||||||
|
sku: "test-variant",
|
||||||
|
prices: [
|
||||||
|
{
|
||||||
|
currency_code: "usd",
|
||||||
|
amount: 10,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
adminHeaders
|
||||||
|
)
|
||||||
|
).data.product
|
||||||
|
|
||||||
returnReason = (
|
returnReason = (
|
||||||
await api.post(
|
await api.post(
|
||||||
"/admin/return-reasons",
|
"/admin/return-reasons",
|
||||||
@@ -39,6 +68,7 @@ medusaIntegrationTestRunner({
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
title: "Custom Item 2",
|
title: "Custom Item 2",
|
||||||
|
variant_id: product.variants[0].id,
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
unit_price: 25,
|
unit_price: 25,
|
||||||
},
|
},
|
||||||
@@ -123,7 +153,7 @@ medusaIntegrationTestRunner({
|
|||||||
)
|
)
|
||||||
).data.shipping_profile
|
).data.shipping_profile
|
||||||
|
|
||||||
let location = (
|
location = (
|
||||||
await api.post(
|
await api.post(
|
||||||
`/admin/stock-locations`,
|
`/admin/stock-locations`,
|
||||||
{
|
{
|
||||||
@@ -155,6 +185,54 @@ medusaIntegrationTestRunner({
|
|||||||
)
|
)
|
||||||
).data.fulfillment_set
|
).data.fulfillment_set
|
||||||
|
|
||||||
|
inventoryItem = (
|
||||||
|
await api.post(
|
||||||
|
`/admin/inventory-items`,
|
||||||
|
{ sku: "inv-1234" },
|
||||||
|
adminHeaders
|
||||||
|
)
|
||||||
|
).data.inventory_item
|
||||||
|
|
||||||
|
await api.post(
|
||||||
|
`/admin/inventory-items/${inventoryItem.id}/location-levels`,
|
||||||
|
{
|
||||||
|
location_id: location.id,
|
||||||
|
stocked_quantity: 2,
|
||||||
|
},
|
||||||
|
adminHeaders
|
||||||
|
)
|
||||||
|
|
||||||
|
const remoteLink = container.resolve(
|
||||||
|
ContainerRegistrationKeys.REMOTE_LINK
|
||||||
|
)
|
||||||
|
|
||||||
|
await remoteLink.create([
|
||||||
|
{
|
||||||
|
[Modules.STOCK_LOCATION]: {
|
||||||
|
stock_location_id: location.id,
|
||||||
|
},
|
||||||
|
[Modules.FULFILLMENT]: {
|
||||||
|
fulfillment_set_id: fulfillmentSet.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
[Modules.SALES_CHANNEL]: {
|
||||||
|
sales_channel_id: "test",
|
||||||
|
},
|
||||||
|
[Modules.STOCK_LOCATION]: {
|
||||||
|
stock_location_id: location.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
[Modules.PRODUCT]: {
|
||||||
|
variant_id: product.variants[0].id,
|
||||||
|
},
|
||||||
|
[Modules.INVENTORY]: {
|
||||||
|
inventory_item_id: inventoryItem.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
const shippingOptionPayload = {
|
const shippingOptionPayload = {
|
||||||
name: "Return shipping",
|
name: "Return shipping",
|
||||||
service_zone_id: fulfillmentSet.service_zones[0].id,
|
service_zone_id: fulfillmentSet.service_zones[0].id,
|
||||||
@@ -715,6 +793,7 @@ medusaIntegrationTestRunner({
|
|||||||
{
|
{
|
||||||
order_id: order.id,
|
order_id: order.id,
|
||||||
description: "Test",
|
description: "Test",
|
||||||
|
location_id: location.id,
|
||||||
},
|
},
|
||||||
adminHeaders
|
adminHeaders
|
||||||
)
|
)
|
||||||
@@ -745,6 +824,14 @@ medusaIntegrationTestRunner({
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should receive the return", async () => {
|
it("should receive the return", async () => {
|
||||||
|
let inventoryLevel = (
|
||||||
|
await api.get(
|
||||||
|
`/admin/inventory-items/${inventoryItem.id}/location-levels?location_id[]=${location.id}`,
|
||||||
|
adminHeaders
|
||||||
|
)
|
||||||
|
).data.inventory_levels
|
||||||
|
expect(inventoryLevel[0].stocked_quantity).toEqual(2)
|
||||||
|
|
||||||
let result = await api.post(
|
let result = await api.post(
|
||||||
`/admin/returns/${returnId}/receive`,
|
`/admin/returns/${returnId}/receive`,
|
||||||
{
|
{
|
||||||
@@ -838,6 +925,14 @@ medusaIntegrationTestRunner({
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
inventoryLevel = (
|
||||||
|
await api.get(
|
||||||
|
`/admin/inventory-items/${inventoryItem.id}/location-levels?location_id[]=${location.id}`,
|
||||||
|
adminHeaders
|
||||||
|
)
|
||||||
|
).data.inventory_levels
|
||||||
|
expect(inventoryLevel[0].stocked_quantity).toEqual(3)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ jest.setTimeout(500000)
|
|||||||
|
|
||||||
const env = { MEDUSA_FF_MEDUSA_V2: true }
|
const env = { MEDUSA_FF_MEDUSA_V2: true }
|
||||||
const providerId = "manual_test-provider"
|
const providerId = "manual_test-provider"
|
||||||
|
const variantSkuWithInventory = "test-variant"
|
||||||
let inventoryItem
|
let inventoryItem
|
||||||
|
|
||||||
async function prepareDataFixtures({ container }) {
|
async function prepareDataFixtures({ container }) {
|
||||||
@@ -97,7 +98,7 @@ async function prepareDataFixtures({ container }) {
|
|||||||
variants: [
|
variants: [
|
||||||
{
|
{
|
||||||
title: "Test variant",
|
title: "Test variant",
|
||||||
sku: "test-variant",
|
sku: variantSkuWithInventory,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Test variant no inventory management",
|
title: "Test variant no inventory management",
|
||||||
@@ -225,6 +226,7 @@ async function createOrderFixture({ container, product, location }) {
|
|||||||
title: "Custom Item 2",
|
title: "Custom Item 2",
|
||||||
variant_sku: product.variants[0].sku,
|
variant_sku: product.variants[0].sku,
|
||||||
variant_title: product.variants[0].title,
|
variant_title: product.variants[0].title,
|
||||||
|
variant_id: product.variants[0].id,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
unit_price: 50,
|
unit_price: 50,
|
||||||
adjustments: [
|
adjustments: [
|
||||||
@@ -351,6 +353,9 @@ medusaIntegrationTestRunner({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const order = await createOrderFixture({ container, product, location })
|
const order = await createOrderFixture({ container, product, location })
|
||||||
|
const itemWithInventory = order.items!.find(
|
||||||
|
(o) => o.variant_sku === variantSkuWithInventory
|
||||||
|
)!
|
||||||
|
|
||||||
// Create a fulfillment
|
// Create a fulfillment
|
||||||
const createOrderFulfillmentData: OrderWorkflow.CreateOrderFulfillmentWorkflowInput =
|
const createOrderFulfillmentData: OrderWorkflow.CreateOrderFulfillmentWorkflowInput =
|
||||||
@@ -359,7 +364,7 @@ medusaIntegrationTestRunner({
|
|||||||
created_by: "user_1",
|
created_by: "user_1",
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
id: order.items![0].id,
|
id: itemWithInventory.id,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -391,11 +396,17 @@ medusaIntegrationTestRunner({
|
|||||||
|
|
||||||
const [orderFulfill] = await remoteQuery(remoteQueryObject)
|
const [orderFulfill] = await remoteQuery(remoteQueryObject)
|
||||||
|
|
||||||
|
let orderFulfillItemWithInventory = orderFulfill.items!.find(
|
||||||
|
(o) => o.variant_sku === variantSkuWithInventory
|
||||||
|
)!
|
||||||
|
|
||||||
expect(orderFulfill.fulfillments).toHaveLength(1)
|
expect(orderFulfill.fulfillments).toHaveLength(1)
|
||||||
expect(orderFulfill.items[0].detail.fulfilled_quantity).toEqual(1)
|
expect(orderFulfillItemWithInventory.detail.fulfilled_quantity).toEqual(
|
||||||
|
1
|
||||||
|
)
|
||||||
|
|
||||||
const reservation = await inventoryModule.listReservationItems({
|
const reservation = await inventoryModule.listReservationItems({
|
||||||
line_item_id: order.items![0].id,
|
line_item_id: itemWithInventory.id,
|
||||||
})
|
})
|
||||||
expect(reservation).toHaveLength(0)
|
expect(reservation).toHaveLength(0)
|
||||||
|
|
||||||
@@ -436,10 +447,14 @@ medusaIntegrationTestRunner({
|
|||||||
remoteQueryObjectFulfill
|
remoteQueryObjectFulfill
|
||||||
)
|
)
|
||||||
|
|
||||||
|
orderFulfillItemWithInventory = orderFulfillAfterCancelled.items!.find(
|
||||||
|
(o) => o.variant_sku === variantSkuWithInventory
|
||||||
|
)!
|
||||||
|
|
||||||
expect(orderFulfillAfterCancelled.fulfillments).toHaveLength(1)
|
expect(orderFulfillAfterCancelled.fulfillments).toHaveLength(1)
|
||||||
expect(
|
expect(orderFulfillItemWithInventory.detail.fulfilled_quantity).toEqual(
|
||||||
orderFulfillAfterCancelled.items[0].detail.fulfilled_quantity
|
0
|
||||||
).toEqual(0)
|
)
|
||||||
|
|
||||||
const stockAvailabilityAfterCancelled =
|
const stockAvailabilityAfterCancelled =
|
||||||
await inventoryModule.retrieveStockedQuantity(inventoryItem.id, [
|
await inventoryModule.retrieveStockedQuantity(inventoryItem.id, [
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { IInventoryService } from "@medusajs/types"
|
import { IInventoryService } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
|
MathBN,
|
||||||
MedusaError,
|
MedusaError,
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
promiseAll,
|
promiseAll,
|
||||||
@@ -30,7 +31,7 @@ export const confirmInventoryStep = createStep(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemQuantity = item.required_quantity * item.quantity
|
const itemQuantity = MathBN.mult(item.quantity, item.required_quantity)
|
||||||
|
|
||||||
return await inventoryService.confirmInventory(
|
return await inventoryService.confirmInventory(
|
||||||
item.inventory_item_id,
|
item.inventory_item_id,
|
||||||
|
|||||||
@@ -51,7 +51,11 @@ export const getLineItemActionsStep = createStep(
|
|||||||
|
|
||||||
itemsToUpdate.push({
|
itemsToUpdate.push({
|
||||||
selector: { id: existingItem.id },
|
selector: { id: existingItem.id },
|
||||||
data: { id: existingItem.id, quantity: quantity },
|
data: {
|
||||||
|
id: existingItem.id,
|
||||||
|
quantity: quantity,
|
||||||
|
variant_id: item.variant_id!,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
itemsToCreate.push(item)
|
itemsToCreate.push(item)
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ import { prepareLineItemData } from "../utils/prepare-line-item-data"
|
|||||||
import { confirmVariantInventoryWorkflow } from "./confirm-variant-inventory"
|
import { confirmVariantInventoryWorkflow } from "./confirm-variant-inventory"
|
||||||
import { refreshPaymentCollectionForCartStep } from "./refresh-payment-collection"
|
import { refreshPaymentCollectionForCartStep } from "./refresh-payment-collection"
|
||||||
|
|
||||||
// TODO: The AddToCartWorkflow are missing the following steps:
|
|
||||||
// - Refresh/delete shipping methods (fulfillment module)
|
|
||||||
|
|
||||||
export const addToCartWorkflowId = "add-to-cart"
|
export const addToCartWorkflowId = "add-to-cart"
|
||||||
export const addToCartWorkflow = createWorkflow(
|
export const addToCartWorkflow = createWorkflow(
|
||||||
addToCartWorkflowId,
|
addToCartWorkflowId,
|
||||||
@@ -60,14 +57,6 @@ export const addToCartWorkflow = createWorkflow(
|
|||||||
|
|
||||||
validateVariantPricesStep({ variants })
|
validateVariantPricesStep({ variants })
|
||||||
|
|
||||||
confirmVariantInventoryWorkflow.runAsStep({
|
|
||||||
input: {
|
|
||||||
sales_channel_id: input.cart.sales_channel_id as string,
|
|
||||||
variants,
|
|
||||||
items: input.items,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const lineItems = transform({ input, variants }, (data) => {
|
const lineItems = transform({ input, variants }, (data) => {
|
||||||
const items = (data.input.items ?? []).map((item) => {
|
const items = (data.input.items ?? []).map((item) => {
|
||||||
const variant = data.variants.find((v) => v.id === item.variant_id)!
|
const variant = data.variants.find((v) => v.id === item.variant_id)!
|
||||||
@@ -91,6 +80,15 @@ export const addToCartWorkflow = createWorkflow(
|
|||||||
items: lineItems,
|
items: lineItems,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
confirmVariantInventoryWorkflow.runAsStep({
|
||||||
|
input: {
|
||||||
|
sales_channel_id: input.cart.sales_channel_id as string,
|
||||||
|
variants,
|
||||||
|
items: input.items,
|
||||||
|
itemsToUpdate,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const [createdItems, updatedItems] = parallelize(
|
const [createdItems, updatedItems] = parallelize(
|
||||||
createLineItemsStep({
|
createLineItemsStep({
|
||||||
id: input.cart.id,
|
id: input.cart.id,
|
||||||
|
|||||||
@@ -34,6 +34,15 @@ export const confirmVariantInventoryWorkflow = createWorkflow(
|
|||||||
|
|
||||||
const salesChannelId = data.input.sales_channel_id
|
const salesChannelId = data.input.sales_channel_id
|
||||||
|
|
||||||
|
for (const updateItem of data.input.itemsToUpdate ?? []) {
|
||||||
|
const item = data.input.items.find(
|
||||||
|
(item) => item.variant_id === updateItem.data.variant_id
|
||||||
|
)
|
||||||
|
if (item && updateItem.data.quantity) {
|
||||||
|
item.quantity = updateItem.data.quantity!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
deepFlatMap(
|
deepFlatMap(
|
||||||
data.input,
|
data.input,
|
||||||
"variants.inventory_items.inventory.location_levels.stock_locations.sales_channels",
|
"variants.inventory_items.inventory.location_levels.stock_locations.sales_channels",
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ function prepareInventoryUpdate({
|
|||||||
location_id: string
|
location_id: string
|
||||||
adjustment: BigNumberInput
|
adjustment: BigNumberInput
|
||||||
}[] = []
|
}[] = []
|
||||||
|
|
||||||
for (const item of fulfillment.items) {
|
for (const item of fulfillment.items) {
|
||||||
// if this is `null` this means that item is from variant that has `manage_inventory` false
|
// if this is `null` this means that item is from variant that has `manage_inventory` false
|
||||||
if (item.inventory_item_id) {
|
if (item.inventory_item_id) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export const beginReturnOrderWorkflow = createWorkflow(
|
|||||||
const created = createReturnsStep([
|
const created = createReturnsStep([
|
||||||
{
|
{
|
||||||
order_id: input.order_id,
|
order_id: input.order_id,
|
||||||
|
location_id: input.location_id,
|
||||||
metadata: input.metadata,
|
metadata: input.metadata,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|||||||
+141
-10
@@ -1,17 +1,25 @@
|
|||||||
import {
|
import {
|
||||||
BigNumberInput,
|
BigNumberInput,
|
||||||
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, MathBN, OrderChangeStatus } from "@medusajs/utils"
|
import {
|
||||||
|
ChangeActionType,
|
||||||
|
MathBN,
|
||||||
|
OrderChangeStatus,
|
||||||
|
deepFlatMap,
|
||||||
|
} from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
WorkflowData,
|
WorkflowData,
|
||||||
createStep,
|
createStep,
|
||||||
createWorkflow,
|
createWorkflow,
|
||||||
|
parallelize,
|
||||||
transform,
|
transform,
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
import { useRemoteQueryStep } from "../../../common"
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { adjustInventoryLevelsStep } from "../../../inventory/steps"
|
||||||
import { previewOrderChangeStep, updateReturnItemsStep } from "../../steps"
|
import { previewOrderChangeStep, updateReturnItemsStep } from "../../steps"
|
||||||
import { confirmOrderChanges } from "../../steps/confirm-order-changes"
|
import { confirmOrderChanges } from "../../steps/confirm-order-changes"
|
||||||
import {
|
import {
|
||||||
@@ -40,13 +48,97 @@ const validationStep = createStep(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Loop through the items in the return and prepare the inventory adjustment of items associated with each variant
|
||||||
|
function prepareInventoryUpdate({ orderReturn, returnedQuantityMap }) {
|
||||||
|
const inventoryAdjustment: {
|
||||||
|
inventory_item_id: string
|
||||||
|
location_id: string
|
||||||
|
adjustment: BigNumberInput
|
||||||
|
}[] = []
|
||||||
|
|
||||||
|
let hasManagedInventory = false
|
||||||
|
let hasStockLocation = false
|
||||||
|
|
||||||
|
const productVariantInventoryItems = new Map<string, any>()
|
||||||
|
|
||||||
|
// Create the map of inventory item ids associated with each variant that have inventory management
|
||||||
|
deepFlatMap(
|
||||||
|
orderReturn.items,
|
||||||
|
"item.variant.inventory_items.inventory.location_levels",
|
||||||
|
({ variant, inventory_items, location_levels }) => {
|
||||||
|
if (!variant?.manage_inventory) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hasManagedInventory = true
|
||||||
|
|
||||||
|
if (location_levels?.location_id !== orderReturn.location_id) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hasStockLocation = true
|
||||||
|
|
||||||
|
if (!inventory_items) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const inventoryItemId = inventory_items.inventory_item_id
|
||||||
|
|
||||||
|
if (!productVariantInventoryItems.has(inventoryItemId)) {
|
||||||
|
productVariantInventoryItems.set(inventoryItemId, {
|
||||||
|
variant_id: inventory_items.variant_id,
|
||||||
|
inventory_item_id: inventoryItemId,
|
||||||
|
required_quantity: inventory_items.required_quantity,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (hasManagedInventory && !hasStockLocation) {
|
||||||
|
throw new Error(
|
||||||
|
`Cannot receive the Return at location ${orderReturn.location_id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust the inventory of all inventory items of each variant in the return
|
||||||
|
for (const [variantId, quantity] of Object.entries(returnedQuantityMap)) {
|
||||||
|
const inventoryItemsByVariant = Array.from(
|
||||||
|
productVariantInventoryItems.values()
|
||||||
|
).filter((i) => i.variant_id === variantId)
|
||||||
|
|
||||||
|
for (const inventoryItem of inventoryItemsByVariant) {
|
||||||
|
inventoryAdjustment.push({
|
||||||
|
inventory_item_id: inventoryItem.inventory_item_id,
|
||||||
|
location_id: orderReturn.location_id,
|
||||||
|
adjustment: MathBN.mult(
|
||||||
|
quantity as number,
|
||||||
|
inventoryItem.required_quantity
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return inventoryAdjustment
|
||||||
|
}
|
||||||
|
|
||||||
export const confirmReturnReceiveWorkflowId = "confirm-return-receive"
|
export const confirmReturnReceiveWorkflowId = "confirm-return-receive"
|
||||||
export const confirmReturnReceiveWorkflow = createWorkflow(
|
export const confirmReturnReceiveWorkflow = createWorkflow(
|
||||||
confirmReturnReceiveWorkflowId,
|
confirmReturnReceiveWorkflowId,
|
||||||
function (input: WorkflowInput): WorkflowData<OrderDTO> {
|
function (input: WorkflowInput): WorkflowData<OrderDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at", "items.*"],
|
fields: [
|
||||||
|
"id",
|
||||||
|
"status",
|
||||||
|
"order_id",
|
||||||
|
"location_id",
|
||||||
|
"canceled_at",
|
||||||
|
"items.*",
|
||||||
|
"items.item.variant_id",
|
||||||
|
"items.item.variant.id",
|
||||||
|
"items.item.variant.manage_inventory",
|
||||||
|
"items.item.variant.inventory_items.inventory_item_id",
|
||||||
|
"items.item.variant.inventory_items.required_quantity",
|
||||||
|
"items.item.variant.inventory_items.inventory.location_levels.location_id",
|
||||||
|
],
|
||||||
variables: { id: input.return_id },
|
variables: { id: input.return_id },
|
||||||
list: false,
|
list: false,
|
||||||
throw_if_key_not_found: true,
|
throw_if_key_not_found: true,
|
||||||
@@ -81,14 +173,42 @@ export const confirmReturnReceiveWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
const updateReturnItem = transform({ orderChange, orderReturn }, (data) => {
|
const { updateReturnItem, returnedQuantityMap } = transform(
|
||||||
const retItems = data.orderReturn.items!
|
{ orderChange, orderReturn },
|
||||||
const received = data.orderChange.actions.filter((act) =>
|
(data) => {
|
||||||
|
const returnedQuantityMap: Record<string, BigNumberInput> = {}
|
||||||
|
|
||||||
|
const retItems = data.orderReturn.items ?? []
|
||||||
|
const received: OrderChangeActionDTO[] = []
|
||||||
|
|
||||||
|
data.orderChange.actions.forEach((act) => {
|
||||||
|
if (
|
||||||
[
|
[
|
||||||
ChangeActionType.RECEIVE_RETURN_ITEM,
|
ChangeActionType.RECEIVE_RETURN_ITEM,
|
||||||
ChangeActionType.RECEIVE_DAMAGED_RETURN_ITEM,
|
ChangeActionType.RECEIVE_DAMAGED_RETURN_ITEM,
|
||||||
].includes(act.action as ChangeActionType)
|
].includes(act.action as ChangeActionType)
|
||||||
|
) {
|
||||||
|
received.push(act)
|
||||||
|
|
||||||
|
if (act.action === ChangeActionType.RECEIVE_RETURN_ITEM) {
|
||||||
|
const itemId = act.details!.reference_id as string
|
||||||
|
|
||||||
|
const variantId = (retItems as any).find(
|
||||||
|
(i: any) => i.item_id === itemId
|
||||||
|
)?.item?.variant_id
|
||||||
|
|
||||||
|
if (!variantId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentQuantity = returnedQuantityMap[variantId] ?? 0
|
||||||
|
returnedQuantityMap[variantId] = MathBN.add(
|
||||||
|
currentQuantity,
|
||||||
|
act.details!.quantity as number
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const itemMap = retItems.reduce((acc, item: any) => {
|
const itemMap = retItems.reduce((acc, item: any) => {
|
||||||
acc[item.item_id] = item.id
|
acc[item.item_id] = item.id
|
||||||
@@ -112,14 +232,25 @@ export const confirmReturnReceiveWorkflow = createWorkflow(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return Object.values(itemUpdates) as any
|
return {
|
||||||
})
|
updateReturnItem: Object.values(itemUpdates) as any,
|
||||||
|
returnedQuantityMap,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const inventoryAdjustment = transform(
|
||||||
|
{ orderReturn, input, returnedQuantityMap },
|
||||||
|
prepareInventoryUpdate
|
||||||
|
)
|
||||||
|
|
||||||
validationStep({ order, orderReturn, orderChange })
|
validationStep({ order, orderReturn, orderChange })
|
||||||
|
|
||||||
updateReturnItemsStep(updateReturnItem)
|
parallelize(
|
||||||
|
updateReturnItemsStep(updateReturnItem),
|
||||||
confirmOrderChanges({ changes: [orderChange], orderId: order.id })
|
confirmOrderChanges({ changes: [orderChange], orderId: order.id }),
|
||||||
|
adjustInventoryLevelsStep(inventoryAdjustment)
|
||||||
|
)
|
||||||
|
|
||||||
return previewOrderChangeStep(order.id)
|
return previewOrderChangeStep(order.id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,6 +149,12 @@ export interface ConfirmVariantInventoryWorkflowInputDTO {
|
|||||||
variant_id?: string
|
variant_id?: string
|
||||||
quantity: BigNumberInput
|
quantity: BigNumberInput
|
||||||
}[]
|
}[]
|
||||||
|
itemsToUpdate?: {
|
||||||
|
data: {
|
||||||
|
variant_id?: string
|
||||||
|
quantity?: BigNumberInput
|
||||||
|
}
|
||||||
|
}[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CartWorkflowDTO {
|
export interface CartWorkflowDTO {
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ export interface RegisterOrderShipmentDTO extends BaseOrderBundledActionsDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
|
export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
|
||||||
|
location_id?: string
|
||||||
items?: {
|
items?: {
|
||||||
id: string
|
id: string
|
||||||
quantity: BigNumberInput
|
quantity: BigNumberInput
|
||||||
@@ -438,6 +439,7 @@ export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
|
|||||||
|
|
||||||
export interface UpdateReturnDTO {
|
export interface UpdateReturnDTO {
|
||||||
id: string
|
id: string
|
||||||
|
location_id?: string
|
||||||
refund_amount?: BigNumberInput
|
refund_amount?: BigNumberInput
|
||||||
no_notification?: boolean
|
no_notification?: boolean
|
||||||
claim_id?: string
|
claim_id?: string
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export interface BeginOrderReturnWorkflowInput {
|
export interface BeginOrderReturnWorkflowInput {
|
||||||
order_id: string
|
order_id: string
|
||||||
|
location_id?: string
|
||||||
created_by?: string
|
created_by?: string
|
||||||
internal_note?: string
|
internal_note?: string
|
||||||
description?: string
|
description?: string
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export const defaultAdminReturnFields = [
|
|||||||
"exchange_id",
|
"exchange_id",
|
||||||
"claim_id",
|
"claim_id",
|
||||||
"display_id",
|
"display_id",
|
||||||
|
"location_id",
|
||||||
"order_version",
|
"order_version",
|
||||||
"status",
|
"status",
|
||||||
"refund_amount",
|
"refund_amount",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types"
|
import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types"
|
||||||
import { moduleIntegrationTestRunner } from "medusa-test-utils"
|
|
||||||
import { Modules } from "@medusajs/utils"
|
import { Modules } from "@medusajs/utils"
|
||||||
|
import { moduleIntegrationTestRunner } from "medusa-test-utils"
|
||||||
|
|
||||||
jest.setTimeout(100000)
|
jest.setTimeout(100000)
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
billing_address: expect.objectContaining({
|
billing_address: expect.objectContaining({
|
||||||
id: expect.stringContaining("ordaddr_"),
|
id: expect.stringContaining("ordaddr_"),
|
||||||
}),
|
}),
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.stringContaining("ordli_"),
|
id: expect.stringContaining("ordli_"),
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
@@ -174,7 +174,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
version: 1,
|
version: 1,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
shipping_methods: [
|
shipping_methods: [
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.stringContaining("ordsm_"),
|
id: expect.stringContaining("ordsm_"),
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ moduleIntegrationTestRunner({
|
|||||||
|
|
||||||
it("should claim an item and add two new items to the order", async function () {
|
it("should claim an item and add two new items to the order", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
// Fullfilment
|
// Fullfilment
|
||||||
await service.registerFulfillment({
|
await service.registerFulfillment({
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
|
|
||||||
it("should change an order by adding actions to it", async function () {
|
it("should change an order by adding actions to it", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
await service.addOrderAction([
|
await service.addOrderAction([
|
||||||
{
|
{
|
||||||
@@ -219,10 +222,12 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
],
|
],
|
||||||
relations: ["items", "shipping_methods", "transactions"],
|
relations: ["items", "shipping_methods", "transactions"],
|
||||||
})
|
})
|
||||||
|
|
||||||
const serializedFinalOrder = JSON.parse(JSON.stringify(finalOrder))
|
const serializedFinalOrder = JSON.parse(JSON.stringify(finalOrder))
|
||||||
|
|
||||||
const serializedCreatedOrder = JSON.parse(JSON.stringify(createdOrder))
|
const serializedCreatedOrder = JSON.parse(JSON.stringify(createdOrder))
|
||||||
expect(serializedCreatedOrder.items).toEqual([
|
expect(serializedCreatedOrder.items).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "Item 1",
|
title: "Item 1",
|
||||||
unit_price: 8,
|
unit_price: 8,
|
||||||
@@ -260,13 +265,15 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
)
|
||||||
|
|
||||||
expect(serializedFinalOrder).toEqual(
|
expect(serializedFinalOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
version: 1,
|
version: 1,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
expect(serializedFinalOrder.items).toEqual([
|
expect(serializedFinalOrder.items).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "Item 1",
|
title: "Item 1",
|
||||||
subtitle: "Subtitle 1",
|
subtitle: "Subtitle 1",
|
||||||
@@ -332,10 +339,14 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should create an order change, add actions to it, confirm the changes, revert all the changes and restore the changes again.", async function () {
|
it("should create an order change, add actions to it, confirm the changes, revert all the changes and restore the changes again.", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
const orderChange = await service.createOrderChange({
|
const orderChange = await service.createOrderChange({
|
||||||
order_id: createdOrder.id,
|
order_id: createdOrder.id,
|
||||||
@@ -439,7 +450,8 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
expect(serializedModifiedOrder.shipping_methods).toHaveLength(1)
|
expect(serializedModifiedOrder.shipping_methods).toHaveLength(1)
|
||||||
expect(serializedModifiedOrder.shipping_methods[0].amount).toEqual(10)
|
expect(serializedModifiedOrder.shipping_methods[0].amount).toEqual(10)
|
||||||
|
|
||||||
expect(serializedModifiedOrder.items).toEqual([
|
expect(serializedModifiedOrder.items).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 2,
|
quantity: 2,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -478,6 +490,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
)
|
||||||
|
|
||||||
// Revert Last Changes
|
// Revert Last Changes
|
||||||
await service.revertLastVersion(createdOrder.id)
|
await service.revertLastVersion(createdOrder.id)
|
||||||
@@ -504,7 +517,8 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
expect(serializedRevertedOrder.shipping_methods).toHaveLength(1)
|
expect(serializedRevertedOrder.shipping_methods).toHaveLength(1)
|
||||||
expect(serializedRevertedOrder.shipping_methods[0].amount).toEqual(10)
|
expect(serializedRevertedOrder.shipping_methods[0].amount).toEqual(10)
|
||||||
|
|
||||||
expect(serializedRevertedOrder.items).toEqual([
|
expect(serializedRevertedOrder.items).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
unit_price: 8,
|
unit_price: 8,
|
||||||
@@ -544,10 +558,14 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should create order change, cancel and reject them.", async function () {
|
it("should create order change, cancel and reject them.", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
const orderChange = await service.createOrderChange({
|
const orderChange = await service.createOrderChange({
|
||||||
order_id: createdOrder.id,
|
order_id: createdOrder.id,
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ moduleIntegrationTestRunner({
|
|||||||
|
|
||||||
it("should exchange an item and add two new items to the order", async function () {
|
it("should exchange an item and add two new items to the order", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
// Fullfilment
|
// Fullfilment
|
||||||
await service.registerFulfillment({
|
await service.registerFulfillment({
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
|
|
||||||
it("should create an order, fulfill, ship and return the items", async function () {
|
it("should create an order, fulfill, ship and return the items", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
// Fullfilment
|
// Fullfilment
|
||||||
await service.registerFulfillment({
|
await service.registerFulfillment({
|
||||||
@@ -135,7 +138,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
|
|
||||||
expect(serializedOrder).toEqual(
|
expect(serializedOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -160,7 +163,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
shipped_quantity: 0,
|
shipped_quantity: 0,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -195,7 +198,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
|
|
||||||
expect(serializedOrder).toEqual(
|
expect(serializedOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -220,7 +223,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
shipped_quantity: 1,
|
shipped_quantity: 1,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -290,7 +293,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
expect(serializedOrder.shipping_methods).toHaveLength(3)
|
expect(serializedOrder.shipping_methods).toHaveLength(3)
|
||||||
expect(serializedOrder).toEqual(
|
expect(serializedOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -318,7 +321,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
return_requested_quantity: 1,
|
return_requested_quantity: 1,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -443,7 +446,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
|
|
||||||
expect(serializedOrder).toEqual(
|
expect(serializedOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -474,13 +477,16 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
return_received_quantity: 1,
|
return_received_quantity: 1,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should create an order, fulfill, return the items and cancel some item return", async function () {
|
it("should create an order, fulfill, return the items and cancel some item return", async function () {
|
||||||
const createdOrder = await service.createOrders(input)
|
const createdOrder = await service.createOrders(input)
|
||||||
|
createdOrder.items = createdOrder.items!.sort((a, b) =>
|
||||||
|
a.title.localeCompare(b.title)
|
||||||
|
)
|
||||||
|
|
||||||
await service.registerFulfillment({
|
await service.registerFulfillment({
|
||||||
order_id: createdOrder.id,
|
order_id: createdOrder.id,
|
||||||
@@ -553,7 +559,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
|
|
||||||
expect(serializedOrder).toEqual(
|
expect(serializedOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -578,7 +584,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
return_requested_quantity: 1,
|
return_requested_quantity: 1,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -628,7 +634,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
expect(serializedOrder.shipping_methods).toHaveLength(2)
|
expect(serializedOrder.shipping_methods).toHaveLength(2)
|
||||||
expect(serializedOrder).toEqual(
|
expect(serializedOrder).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
items: [
|
items: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
detail: expect.objectContaining({
|
detail: expect.objectContaining({
|
||||||
@@ -659,7 +665,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
|||||||
return_received_quantity: 0,
|
return_received_quantity: 0,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
]),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -115,37 +115,37 @@ export class Migration20240219102530 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_display_id" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_display_id" ON "order" (
|
||||||
display_id
|
display_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_region_id" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_region_id" ON "order" (
|
||||||
region_id
|
region_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_customer_id" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_customer_id" ON "order" (
|
||||||
customer_id
|
customer_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_customer_id" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_customer_id" ON "order" (
|
||||||
customer_id
|
customer_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_currency_code" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_currency_code" ON "order" (
|
||||||
currency_code
|
currency_code
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_address_id" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_address_id" ON "order" (
|
||||||
shipping_address_id
|
shipping_address_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_billing_address_id" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_billing_address_id" ON "order" (
|
||||||
billing_address_id
|
billing_address_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_deleted_at" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_deleted_at" ON "order" (
|
||||||
deleted_at
|
deleted_at
|
||||||
@@ -154,7 +154,7 @@ export class Migration20240219102530 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_is_draft_order" ON "order" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_is_draft_order" ON "order" (
|
||||||
is_draft_order
|
is_draft_order
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "order_summary" (
|
CREATE TABLE IF NOT EXISTS "order_summary" (
|
||||||
@@ -172,7 +172,7 @@ export class Migration20240219102530 extends Migration {
|
|||||||
order_id,
|
order_id,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "order_change" (
|
CREATE TABLE IF NOT EXISTS "order_change" (
|
||||||
"id" TEXT NOT NULL,
|
"id" TEXT NOT NULL,
|
||||||
@@ -276,18 +276,18 @@ export class Migration20240219102530 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_item_order_id" ON "order_item" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_item_order_id" ON "order_item" (
|
||||||
order_id
|
order_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_item_order_id_version" ON "order_item" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_item_order_id_version" ON "order_item" (
|
||||||
order_id,
|
order_id,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_item_item_id" ON "order_item" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_item_item_id" ON "order_item" (
|
||||||
item_id
|
item_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "order_shipping" (
|
CREATE TABLE IF NOT EXISTS "order_shipping" (
|
||||||
"id" TEXT NOT NULL,
|
"id" TEXT NOT NULL,
|
||||||
@@ -303,18 +303,18 @@ export class Migration20240219102530 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_order_id" ON "order_shipping" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_order_id" ON "order_shipping" (
|
||||||
order_id
|
order_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_order_id_version" ON "order_shipping" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_order_id_version" ON "order_shipping" (
|
||||||
order_id,
|
order_id,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_item_id" ON "order_shipping" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_item_id" ON "order_shipping" (
|
||||||
shipping_method_id
|
shipping_method_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "order_line_item" (
|
CREATE TABLE IF NOT EXISTS "order_line_item" (
|
||||||
"id" TEXT NOT NULL,
|
"id" TEXT NOT NULL,
|
||||||
@@ -461,17 +461,17 @@ export class Migration20240219102530 extends Migration {
|
|||||||
order_id,
|
order_id,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_currency_code" ON "order_transaction" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_currency_code" ON "order_transaction" (
|
||||||
currency_code
|
currency_code
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_reference_id" ON "order_transaction" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_reference_id" ON "order_transaction" (
|
||||||
reference_id
|
reference_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "return_reason"
|
CREATE TABLE IF NOT EXISTS "return_reason"
|
||||||
(
|
(
|
||||||
@@ -492,7 +492,7 @@ export class Migration20240219102530 extends Migration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_return_reason_value" ON "return_reason" USING btree (value ASC NULLS LAST)
|
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_return_reason_value" ON "return_reason" USING btree (value ASC NULLS LAST)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE if exists "order"
|
ALTER TABLE if exists "order"
|
||||||
|
|||||||
@@ -32,17 +32,17 @@ export class Migration20240604100512 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_return_id" ON "order_transaction" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_return_id" ON "order_transaction" (
|
||||||
return_id
|
return_id
|
||||||
)
|
)
|
||||||
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_claim_id" ON "order_transaction" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_claim_id" ON "order_transaction" (
|
||||||
claim_id
|
claim_id
|
||||||
)
|
)
|
||||||
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_exchange_id" ON "order_transaction" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_exchange_id" ON "order_transaction" (
|
||||||
exchange_id
|
exchange_id
|
||||||
)
|
)
|
||||||
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -58,17 +58,17 @@ export class Migration20240604100512 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_return_id" ON "order_shipping" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_return_id" ON "order_shipping" (
|
||||||
return_id
|
return_id
|
||||||
)
|
)
|
||||||
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_claim_id" ON "order_shipping" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_claim_id" ON "order_shipping" (
|
||||||
claim_id
|
claim_id
|
||||||
)
|
)
|
||||||
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_exchange_id" ON "order_shipping" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_exchange_id" ON "order_shipping" (
|
||||||
exchange_id
|
exchange_id
|
||||||
)
|
)
|
||||||
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -85,17 +85,17 @@ export class Migration20240604100512 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_change_return_id" ON "order_change" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_change_return_id" ON "order_change" (
|
||||||
return_id
|
return_id
|
||||||
)
|
)
|
||||||
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_change_claim_id" ON "order_change" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_change_claim_id" ON "order_change" (
|
||||||
claim_id
|
claim_id
|
||||||
)
|
)
|
||||||
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_change_exchange_id" ON "order_change" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_change_exchange_id" ON "order_change" (
|
||||||
exchange_id
|
exchange_id
|
||||||
)
|
)
|
||||||
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -118,17 +118,17 @@ export class Migration20240604100512 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_return_id" ON "order_change_action" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_return_id" ON "order_change_action" (
|
||||||
return_id
|
return_id
|
||||||
)
|
)
|
||||||
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_claim_id" ON "order_change_action" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_claim_id" ON "order_change_action" (
|
||||||
claim_id
|
claim_id
|
||||||
)
|
)
|
||||||
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_exchange_id" ON "order_change_action" (
|
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_exchange_id" ON "order_change_action" (
|
||||||
exchange_id
|
exchange_id
|
||||||
)
|
)
|
||||||
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -162,22 +162,22 @@ export class Migration20240604100512 extends Migration {
|
|||||||
CREATE INDEX IF NOT EXISTS "IDX_return_order_id" ON "return" (
|
CREATE INDEX IF NOT EXISTS "IDX_return_order_id" ON "return" (
|
||||||
order_id
|
order_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_claim_id" ON "return" (
|
CREATE INDEX IF NOT EXISTS "IDX_return_claim_id" ON "return" (
|
||||||
claim_id
|
claim_id
|
||||||
)
|
)
|
||||||
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_exchange_id" ON "return" (
|
CREATE INDEX IF NOT EXISTS "IDX_return_exchange_id" ON "return" (
|
||||||
exchange_id
|
exchange_id
|
||||||
)
|
)
|
||||||
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_display_id" ON "return" (
|
CREATE INDEX IF NOT EXISTS "IDX_return_display_id" ON "return" (
|
||||||
display_id
|
display_id
|
||||||
)
|
)
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "return_item" (
|
CREATE TABLE IF NOT EXISTS "return_item" (
|
||||||
@@ -198,16 +198,16 @@ export class Migration20240604100512 extends Migration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_item_deleted_at" ON "return_item" ("deleted_at")
|
CREATE INDEX IF NOT EXISTS "IDX_return_item_deleted_at" ON "return_item" ("deleted_at")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_item_return_id" ON "return_item" ("return_id")
|
CREATE INDEX IF NOT EXISTS "IDX_return_item_return_id" ON "return_item" ("return_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_item_item_id" ON "return_item" ("item_id")
|
CREATE INDEX IF NOT EXISTS "IDX_return_item_item_id" ON "return_item" ("item_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_return_item_reason_id" ON "return_item" ("reason_id")
|
CREATE INDEX IF NOT EXISTS "IDX_return_item_reason_id" ON "return_item" ("reason_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -230,16 +230,16 @@ export class Migration20240604100512 extends Migration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_display_id" ON "order_exchange" ("display_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_display_id" ON "order_exchange" ("display_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_deleted_at" ON "order_exchange" ("deleted_at")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_deleted_at" ON "order_exchange" ("deleted_at")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_order_id" ON "order_exchange" ("order_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_order_id" ON "order_exchange" ("order_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_return_id" ON "order_exchange" ("return_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_return_id" ON "order_exchange" ("return_id")
|
||||||
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "order_exchange_item" (
|
CREATE TABLE IF NOT EXISTS "order_exchange_item" (
|
||||||
@@ -257,13 +257,13 @@ export class Migration20240604100512 extends Migration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_deleted_at" ON "order_exchange_item" ("deleted_at")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_deleted_at" ON "order_exchange_item" ("deleted_at")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_exchange_id" ON "order_exchange_item" ("exchange_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_exchange_id" ON "order_exchange_item" ("exchange_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_item_id" ON "order_exchange_item" ("item_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_item_id" ON "order_exchange_item" ("item_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -291,16 +291,16 @@ export class Migration20240604100512 extends Migration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_display_id" ON "order_claim" ("display_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_display_id" ON "order_claim" ("display_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_deleted_at" ON "order_claim" ("deleted_at")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_deleted_at" ON "order_claim" ("deleted_at")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_order_id" ON "order_claim" ("order_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_order_id" ON "order_claim" ("order_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_return_id" ON "order_claim" ("return_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_return_id" ON "order_claim" ("return_id")
|
||||||
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
|
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -328,13 +328,13 @@ export class Migration20240604100512 extends Migration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_deleted_at" ON "order_claim_item" ("deleted_at")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_deleted_at" ON "order_claim_item" ("deleted_at")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_claim_id" ON "order_claim_item" ("claim_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_claim_id" ON "order_claim_item" ("claim_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_item_id" ON "order_claim_item" ("item_id")
|
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_item_id" ON "order_claim_item" ("item_id")
|
||||||
WHERE deleted_at IS NOT NULL;
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user