feat(order): Claim and Exchange entities (#7681)
This commit is contained in:
@@ -14,8 +14,10 @@ import {
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import { Return } from "@models"
|
||||
import Claim from "./claim"
|
||||
import Exchange from "./exchange"
|
||||
import Order from "./order"
|
||||
import Return from "./return"
|
||||
|
||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
||||
|
||||
@@ -37,6 +39,18 @@ const ReturnIdIndex = createPsqlIndexStatementHelper({
|
||||
where: "return_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ExchangeIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
columns: ["exchange_id"],
|
||||
where: "exchange_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ClaimIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
columns: ["claim_id"],
|
||||
where: "claim_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const CurrencyCodeIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
columns: "currency_code",
|
||||
@@ -93,6 +107,36 @@ export default class Transaction {
|
||||
})
|
||||
return: Return
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => Exchange,
|
||||
mapToPk: true,
|
||||
fieldName: "exchange_id",
|
||||
columnType: "text",
|
||||
nullable: true,
|
||||
})
|
||||
@ExchangeIdIndex.MikroORMIndex()
|
||||
exchange_id: string | null
|
||||
|
||||
@ManyToOne(() => Exchange, {
|
||||
persist: false,
|
||||
})
|
||||
exchange: Exchange
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => Claim,
|
||||
mapToPk: true,
|
||||
fieldName: "claim_id",
|
||||
columnType: "text",
|
||||
nullable: true,
|
||||
})
|
||||
@ClaimIdIndex.MikroORMIndex()
|
||||
claim_id: string | null
|
||||
|
||||
@ManyToOne(() => Claim, {
|
||||
persist: false,
|
||||
})
|
||||
claim: Claim
|
||||
|
||||
@Property({
|
||||
columnType: "integer",
|
||||
defaultRaw: "1",
|
||||
|
||||
Reference in New Issue
Block a user