core(core-flows, medusa): remove request item return (#8146)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20240715102100 extends Migration {
|
||||
export class Migration20240715174100 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
const sql = `
|
||||
DROP INDEX IF EXISTS "IDX_order_shipping_method_shipping_option_id";
|
||||
@@ -11,8 +11,6 @@ export class Migration20240715102100 extends Migration {
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_method_shipping_option_id" ON "order_shipping_method" (
|
||||
shipping_option_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
|
||||
|
||||
`
|
||||
|
||||
this.addSql(sql)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20240716081800 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
const sql = `
|
||||
DROP INDEX IF EXISTS "IDX_order_line_item_variant_id";
|
||||
DROP INDEX IF EXISTS "IDX_order_line_item_product_id";
|
||||
|
||||
ALTER TABLE "order_line_item"
|
||||
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_variant_id" ON "order_line_item" (
|
||||
variant_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_product_id" ON "order_line_item" (
|
||||
product_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
|
||||
|
||||
|
||||
DROP INDEX IF EXISTS "IDX_order_shipping_method_tax_line_shipping_method_id";
|
||||
|
||||
ALTER TABLE "order_shipping_method_tax_line"
|
||||
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_method_tax_line_shipping_method_id" ON "order_shipping_method_tax_line" (
|
||||
shipping_method_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
|
||||
|
||||
DROP INDEX IF EXISTS "IDX_order_shipping_method_adjustment_shipping_method_id";
|
||||
|
||||
ALTER TABLE "order_shipping_method_adjustment"
|
||||
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_method_adjustment_shipping_method_id" ON "order_shipping_method_adjustment" (
|
||||
shipping_method_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
|
||||
|
||||
|
||||
DROP INDEX IF EXISTS "IDX_order_line_item_tax_line_item_id";
|
||||
|
||||
ALTER TABLE "order_line_item_tax_line"
|
||||
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_tax_line_item_id" ON "order_line_item_tax_line" (
|
||||
item_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
|
||||
DROP INDEX IF EXISTS "IDX_order_line_item_adjustment_item_id";
|
||||
|
||||
ALTER TABLE "order_line_item_adjustment"
|
||||
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_adjustment_item_id" ON "order_line_item_adjustment" (
|
||||
item_id
|
||||
) WHERE deleted_at IS NULL;
|
||||
`
|
||||
|
||||
this.addSql(sql)
|
||||
}
|
||||
}
|
||||
@@ -49,4 +49,7 @@ export default abstract class AdjustmentLine {
|
||||
defaultRaw: "now()",
|
||||
})
|
||||
updated_at: Date
|
||||
|
||||
@Property({ columnType: "timestamptz", nullable: true })
|
||||
deleted_at: Date | null = null
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BigNumberRawValue, DAL } from "@medusajs/types"
|
||||
import {
|
||||
BigNumber,
|
||||
DALUtils,
|
||||
MikroOrmBigNumberProperty,
|
||||
createPsqlIndexStatementHelper,
|
||||
generateEntityId,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
Cascade,
|
||||
Collection,
|
||||
Entity,
|
||||
Filter,
|
||||
OnInit,
|
||||
OneToMany,
|
||||
OptionalProps,
|
||||
@@ -22,17 +24,26 @@ import LineItemTaxLine from "./line-item-tax-line"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_line_item",
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ProductIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_line_item",
|
||||
columns: "product_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const VariantIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_line_item",
|
||||
columns: "variant_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_line_item" })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
export default class LineItem {
|
||||
[OptionalProps]?: OptionalLineItemProps
|
||||
|
||||
@@ -145,6 +156,10 @@ export default class LineItem {
|
||||
})
|
||||
updated_at: Date
|
||||
|
||||
@Property({ columnType: "timestamptz", nullable: true })
|
||||
@DeletedAtIndex.MikroORMIndex()
|
||||
deleted_at: Date | null = null
|
||||
|
||||
@BeforeCreate()
|
||||
onCreate() {
|
||||
this.id = generateEntityId(this.id, "ordli")
|
||||
|
||||
@@ -71,7 +71,7 @@ export default class ShippingMethod {
|
||||
() => ShippingMethodTaxLine,
|
||||
(taxLine) => taxLine.shipping_method,
|
||||
{
|
||||
cascade: [Cascade.PERSIST, "soft-remove"] as any,
|
||||
cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
|
||||
}
|
||||
)
|
||||
tax_lines = new Collection<Rel<ShippingMethodTaxLine>>(this)
|
||||
@@ -80,7 +80,7 @@ export default class ShippingMethod {
|
||||
() => ShippingMethodAdjustment,
|
||||
(adjustment) => adjustment.shipping_method,
|
||||
{
|
||||
cascade: [Cascade.PERSIST, "soft-remove"] as any,
|
||||
cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
|
||||
}
|
||||
)
|
||||
adjustments = new Collection<Rel<ShippingMethodAdjustment>>(this)
|
||||
|
||||
@@ -45,4 +45,7 @@ export default abstract class TaxLine {
|
||||
defaultRaw: "now()",
|
||||
})
|
||||
updated_at: Date
|
||||
|
||||
@Property({ columnType: "timestamptz", nullable: true })
|
||||
deleted_at: Date | null = null
|
||||
}
|
||||
|
||||
@@ -2124,8 +2124,6 @@ export default class OrderModuleService<
|
||||
})
|
||||
}
|
||||
|
||||
// TODO - add new shipping methods
|
||||
|
||||
const calcOrder = calculated.order
|
||||
|
||||
decorateCartTotals(calcOrder as DecorateCartLikeInputDTO)
|
||||
|
||||
Reference in New Issue
Block a user