core(core-flows, medusa): remove request item return (#8146)

This commit is contained in:
Carlos R. L. Rodrigues
2024-07-16 11:23:34 -03:00
committed by GitHub
parent 4024935e91
commit 5813216c88
16 changed files with 320 additions and 20 deletions
@@ -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
}