Feat(order): post purchase support (#7666)
This commit is contained in:
committed by
GitHub
parent
39ddba2491
commit
37426939da
@@ -12,6 +12,7 @@ import {
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import { Return } from "@models"
|
||||
import Order from "./order"
|
||||
import ShippingMethod from "./shipping-method"
|
||||
|
||||
@@ -23,6 +24,12 @@ const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ReturnIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
columns: "return_id",
|
||||
where: "return_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const OrderVersionIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
columns: ["version"],
|
||||
@@ -57,15 +64,30 @@ export default class OrderShippingMethod {
|
||||
@OrderIdIndex.MikroORMIndex()
|
||||
order_id: string
|
||||
|
||||
@Property({ columnType: "integer" })
|
||||
@OrderVersionIndex.MikroORMIndex()
|
||||
version: number
|
||||
|
||||
@ManyToOne(() => Order, {
|
||||
persist: false,
|
||||
})
|
||||
order: Order
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => Return,
|
||||
mapToPk: true,
|
||||
fieldName: "return_id",
|
||||
columnType: "text",
|
||||
nullable: true,
|
||||
})
|
||||
@ReturnIdIndex.MikroORMIndex()
|
||||
return_id: string | null = null
|
||||
|
||||
@ManyToOne(() => Return, {
|
||||
persist: false,
|
||||
})
|
||||
return: Return
|
||||
|
||||
@Property({ columnType: "integer" })
|
||||
@OrderVersionIndex.MikroORMIndex()
|
||||
version: number
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => ShippingMethod,
|
||||
fieldName: "shipping_method_id",
|
||||
|
||||
Reference in New Issue
Block a user