fix(orchestration): remote joiner alias conflict (#8844)
This commit is contained in:
committed by
GitHub
parent
68f3244de3
commit
6cfe9bd874
@@ -21,7 +21,7 @@ const FulfillmentDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName: "fulfillment_address" })
|
||||
export default class Address {
|
||||
export default class FulfillmentAddress {
|
||||
[OptionalProps]: OptionalAddressProps
|
||||
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import Address from "./address"
|
||||
import FulfillmentAddress from "./address"
|
||||
import FulfillmentItem from "./fulfillment-item"
|
||||
import FulfillmentLabel from "./fulfillment-label"
|
||||
import FulfillmentProvider from "./fulfillment-provider"
|
||||
@@ -127,13 +127,13 @@ export default class Fulfillment {
|
||||
provider: Rel<FulfillmentProvider>
|
||||
|
||||
@OneToOne({
|
||||
entity: () => Address,
|
||||
entity: () => FulfillmentAddress,
|
||||
owner: true,
|
||||
cascade: [Cascade.PERSIST, "soft-remove"] as any,
|
||||
nullable: true,
|
||||
onDelete: "cascade",
|
||||
})
|
||||
delivery_address!: Rel<Address>
|
||||
delivery_address!: Rel<FulfillmentAddress>
|
||||
|
||||
@OneToMany(() => FulfillmentItem, (item) => item.fulfillment, {
|
||||
cascade: [Cascade.PERSIST, "soft-remove"] as any,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { default as Address } from "./address"
|
||||
export { default as FulfillmentAddress } from "./address"
|
||||
export { default as Fulfillment } from "./fulfillment"
|
||||
export { default as FulfillmentItem } from "./fulfillment-item"
|
||||
export { default as FulfillmentLabel } from "./fulfillment-label"
|
||||
@@ -10,4 +10,3 @@ export { default as ShippingOption } from "./shipping-option"
|
||||
export { default as ShippingOptionRule } from "./shipping-option-rule"
|
||||
export { default as ShippingOptionType } from "./shipping-option-type"
|
||||
export { default as ShippingProfile } from "./shipping-profile"
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
})
|
||||
)
|
||||
|
||||
const refund = await service.addTransactions([
|
||||
const refund = await service.addOrderTransactions([
|
||||
{
|
||||
order_id: created.id,
|
||||
amount: -20,
|
||||
@@ -242,7 +242,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
})
|
||||
)
|
||||
|
||||
await service.softDeleteTransactions([refund[0].id])
|
||||
await service.softDeleteOrderTransactions([refund[0].id])
|
||||
|
||||
const serializedOrder2 = JSON.parse(
|
||||
JSON.stringify(
|
||||
@@ -261,7 +261,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
})
|
||||
)
|
||||
|
||||
await service.addTransactions([
|
||||
await service.addOrderTransactions([
|
||||
{
|
||||
order_id: created.id,
|
||||
amount: -50,
|
||||
@@ -286,7 +286,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
})
|
||||
)
|
||||
|
||||
await service.restoreTransactions([refund[0].id])
|
||||
await service.restoreOrderTransactions([refund[0].id])
|
||||
|
||||
const serializedOrder4 = JSON.parse(
|
||||
JSON.stringify(
|
||||
|
||||
@@ -14,19 +14,19 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
|
||||
expect(Object.keys(linkable)).toEqual([
|
||||
"order",
|
||||
"address",
|
||||
"lineItem",
|
||||
"lineItemAdjustment",
|
||||
"lineItemTaxLine",
|
||||
"shippingMethod",
|
||||
"shippingMethodAdjustment",
|
||||
"shippingMethodTaxLine",
|
||||
"transaction",
|
||||
"orderAddress",
|
||||
"orderLineItem",
|
||||
"orderLineItemAdjustment",
|
||||
"orderLineItemTaxLine",
|
||||
"orderShippingMethod",
|
||||
"orderShippingMethodAdjustment",
|
||||
"orderShippingMethodTaxLine",
|
||||
"orderTransaction",
|
||||
"orderChange",
|
||||
"orderChangeAction",
|
||||
"orderItem",
|
||||
"orderSummary",
|
||||
"orderShippingMethod",
|
||||
"orderShipping",
|
||||
"returnReason",
|
||||
"return",
|
||||
"returnItem",
|
||||
@@ -50,68 +50,68 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
field: "order",
|
||||
},
|
||||
},
|
||||
address: {
|
||||
orderAddress: {
|
||||
id: {
|
||||
linkable: "address_id",
|
||||
linkable: "order_address_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "address",
|
||||
field: "orderAddress",
|
||||
},
|
||||
},
|
||||
lineItem: {
|
||||
orderLineItem: {
|
||||
id: {
|
||||
linkable: "line_item_id",
|
||||
linkable: "order_line_item_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "lineItem",
|
||||
field: "orderLineItem",
|
||||
},
|
||||
},
|
||||
lineItemAdjustment: {
|
||||
orderLineItemAdjustment: {
|
||||
id: {
|
||||
linkable: "line_item_adjustment_id",
|
||||
linkable: "order_line_item_adjustment_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "lineItemAdjustment",
|
||||
field: "orderLineItemAdjustment",
|
||||
},
|
||||
},
|
||||
lineItemTaxLine: {
|
||||
orderLineItemTaxLine: {
|
||||
id: {
|
||||
linkable: "line_item_tax_line_id",
|
||||
linkable: "order_line_item_tax_line_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "lineItemTaxLine",
|
||||
field: "orderLineItemTaxLine",
|
||||
},
|
||||
},
|
||||
shippingMethod: {
|
||||
orderShippingMethod: {
|
||||
id: {
|
||||
linkable: "shipping_method_id",
|
||||
linkable: "order_shipping_method_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "shippingMethod",
|
||||
field: "orderShippingMethod",
|
||||
},
|
||||
},
|
||||
shippingMethodAdjustment: {
|
||||
orderShippingMethodAdjustment: {
|
||||
id: {
|
||||
linkable: "shipping_method_adjustment_id",
|
||||
linkable: "order_shipping_method_adjustment_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "shippingMethodAdjustment",
|
||||
field: "orderShippingMethodAdjustment",
|
||||
},
|
||||
},
|
||||
shippingMethodTaxLine: {
|
||||
orderShippingMethodTaxLine: {
|
||||
id: {
|
||||
linkable: "shipping_method_tax_line_id",
|
||||
linkable: "order_shipping_method_tax_line_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "shippingMethodTaxLine",
|
||||
field: "orderShippingMethodTaxLine",
|
||||
},
|
||||
},
|
||||
transaction: {
|
||||
orderTransaction: {
|
||||
id: {
|
||||
linkable: "transaction_id",
|
||||
linkable: "order_transaction_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "transaction",
|
||||
field: "orderTransaction",
|
||||
},
|
||||
},
|
||||
orderChange: {
|
||||
@@ -146,12 +146,12 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
field: "orderSummary",
|
||||
},
|
||||
},
|
||||
orderShippingMethod: {
|
||||
orderShipping: {
|
||||
id: {
|
||||
linkable: "order_shipping_method_id",
|
||||
linkable: "order_shipping_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "orderShippingMethod",
|
||||
field: "orderShipping",
|
||||
},
|
||||
},
|
||||
returnReason: {
|
||||
@@ -188,18 +188,18 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
},
|
||||
orderClaimItem: {
|
||||
id: {
|
||||
field: "orderClaimItem",
|
||||
linkable: "order_claim_item_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "orderClaimItem",
|
||||
},
|
||||
},
|
||||
orderClaimItemImage: {
|
||||
id: {
|
||||
field: "orderClaimItemImage",
|
||||
linkable: "order_claim_item_image_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "orderClaimItemImage",
|
||||
},
|
||||
},
|
||||
orderExchange: {
|
||||
@@ -212,10 +212,10 @@ moduleIntegrationTestRunner<IOrderModuleService>({
|
||||
},
|
||||
orderExchangeItem: {
|
||||
id: {
|
||||
field: "orderExchangeItem",
|
||||
linkable: "order_exchange_item_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "order",
|
||||
field: "orderExchangeItem",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ const CustomerIdIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_address" })
|
||||
export default class Address {
|
||||
export default class OrderAddress {
|
||||
[OptionalProps]: OptionalAddressProps
|
||||
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
} from "@mikro-orm/core"
|
||||
import Claim from "./claim"
|
||||
import OrderClaimItemImage from "./claim-item-image"
|
||||
import LineItem from "./line-item"
|
||||
import OrderLineItem from "./line-item"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class OrderClaimItem {
|
||||
claim: Rel<Claim>
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => LineItem,
|
||||
entity: () => OrderLineItem,
|
||||
fieldName: "item_id",
|
||||
mapToPk: true,
|
||||
columnType: "text",
|
||||
@@ -88,10 +88,10 @@ export default class OrderClaimItem {
|
||||
@ItemIdIndex.MikroORMIndex()
|
||||
item_id: string
|
||||
|
||||
@ManyToOne(() => LineItem, {
|
||||
@ManyToOne(() => OrderLineItem, {
|
||||
persist: false,
|
||||
})
|
||||
item: Rel<LineItem>
|
||||
item: Rel<OrderLineItem>
|
||||
|
||||
@Property({ columnType: "boolean", default: false })
|
||||
is_additional_item: boolean = false
|
||||
|
||||
@@ -25,9 +25,9 @@ import {
|
||||
} from "@mikro-orm/core"
|
||||
import ClaimItem from "./claim-item"
|
||||
import Order from "./order"
|
||||
import OrderShippingMethod from "./order-shipping-method"
|
||||
import OrderShipping from "./order-shipping-method"
|
||||
import Return from "./return"
|
||||
import Transaction from "./transaction"
|
||||
import OrderTransaction from "./transaction"
|
||||
|
||||
type OptionalOrderClaimProps = DAL.ModelDateColumns
|
||||
|
||||
@@ -123,19 +123,15 @@ export default class OrderClaim {
|
||||
})
|
||||
claim_items = new Collection<Rel<ClaimItem>>(this)
|
||||
|
||||
@OneToMany(
|
||||
() => OrderShippingMethod,
|
||||
(shippingMethod) => shippingMethod.claim,
|
||||
{
|
||||
cascade: [Cascade.PERSIST],
|
||||
}
|
||||
)
|
||||
shipping_methods = new Collection<Rel<OrderShippingMethod>>(this)
|
||||
|
||||
@OneToMany(() => Transaction, (transaction) => transaction.claim, {
|
||||
@OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.claim, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<Transaction>(this)
|
||||
shipping_methods = new Collection<Rel<OrderShipping>>(this)
|
||||
|
||||
@OneToMany(() => OrderTransaction, (transaction) => transaction.claim, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<OrderTransaction>(this)
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
created_by: string | null = null
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import Exchange from "./exchange"
|
||||
import LineItem from "./line-item"
|
||||
import OrderLineItem from "./line-item"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
@@ -64,7 +64,7 @@ export default class OrderExchangeItem {
|
||||
exchange: Exchange
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => LineItem,
|
||||
entity: () => OrderLineItem,
|
||||
fieldName: "item_id",
|
||||
mapToPk: true,
|
||||
columnType: "text",
|
||||
@@ -72,10 +72,10 @@ export default class OrderExchangeItem {
|
||||
@ItemIdIndex.MikroORMIndex()
|
||||
item_id: string
|
||||
|
||||
@ManyToOne(() => LineItem, {
|
||||
@ManyToOne(() => OrderLineItem, {
|
||||
persist: false,
|
||||
})
|
||||
item: LineItem
|
||||
item: OrderLineItem
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
note: string
|
||||
|
||||
@@ -21,9 +21,9 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import { OrderExchangeItem, Transaction } from "@models"
|
||||
import { OrderExchangeItem, OrderTransaction } from "@models"
|
||||
import Order from "./order"
|
||||
import OrderShippingMethod from "./order-shipping-method"
|
||||
import OrderShipping from "./order-shipping-method"
|
||||
import Return from "./return"
|
||||
|
||||
type OptionalOrderExchangeProps = DAL.ModelDateColumns
|
||||
@@ -115,19 +115,15 @@ export default class OrderExchange {
|
||||
})
|
||||
additional_items = new Collection<Rel<OrderExchangeItem>>(this)
|
||||
|
||||
@OneToMany(
|
||||
() => OrderShippingMethod,
|
||||
(shippingMethod) => shippingMethod.exchange,
|
||||
{
|
||||
cascade: [Cascade.PERSIST],
|
||||
}
|
||||
)
|
||||
shipping_methods = new Collection<Rel<OrderShippingMethod>>(this)
|
||||
|
||||
@OneToMany(() => Transaction, (transaction) => transaction.exchange, {
|
||||
@OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.exchange, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<Transaction>(this)
|
||||
shipping_methods = new Collection<Rel<OrderShipping>>(this)
|
||||
|
||||
@OneToMany(() => OrderTransaction, (transaction) => transaction.exchange, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<OrderTransaction>(this)
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
created_by: string | null = null
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
export { default as Address } from "./address"
|
||||
export { default as OrderAddress } from "./address"
|
||||
export { default as OrderClaim } from "./claim"
|
||||
export { default as OrderClaimItem } from "./claim-item"
|
||||
export { default as OrderClaimItemImage } from "./claim-item-image"
|
||||
export { default as OrderExchange } from "./exchange"
|
||||
export { default as OrderExchangeItem } from "./exchange-item"
|
||||
export { default as LineItem } from "./line-item"
|
||||
export { default as LineItemAdjustment } from "./line-item-adjustment"
|
||||
export { default as LineItemTaxLine } from "./line-item-tax-line"
|
||||
export { default as OrderLineItem } from "./line-item"
|
||||
export { default as OrderLineItemAdjustment } from "./line-item-adjustment"
|
||||
export { default as OrderLineItemTaxLine } from "./line-item-tax-line"
|
||||
export { default as Order } from "./order"
|
||||
export { default as OrderChange } from "./order-change"
|
||||
export { default as OrderChangeAction } from "./order-change-action"
|
||||
export { default as OrderItem } from "./order-item"
|
||||
export { default as OrderShippingMethod } from "./order-shipping-method"
|
||||
export { default as OrderShipping } from "./order-shipping-method"
|
||||
export { default as OrderSummary } from "./order-summary"
|
||||
export { default as Return } from "./return"
|
||||
export { default as ReturnItem } from "./return-item"
|
||||
export { default as ReturnReason } from "./return-reason"
|
||||
export { default as ShippingMethod } from "./shipping-method"
|
||||
export { default as ShippingMethodAdjustment } from "./shipping-method-adjustment"
|
||||
export { default as ShippingMethodTaxLine } from "./shipping-method-tax-line"
|
||||
export { default as Transaction } from "./transaction"
|
||||
export { default as OrderShippingMethod } from "./shipping-method"
|
||||
export { default as OrderShippingMethodAdjustment } from "./shipping-method-adjustment"
|
||||
export { default as OrderShippingMethodTaxLine } from "./shipping-method-tax-line"
|
||||
export { default as OrderTransaction } from "./transaction"
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
} from "@medusajs/utils"
|
||||
import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core"
|
||||
import AdjustmentLine from "./adjustment-line"
|
||||
import LineItem from "./line-item"
|
||||
import OrderLineItem from "./line-item"
|
||||
|
||||
const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_line_item_adjustment",
|
||||
@@ -12,14 +12,14 @@ const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_line_item_adjustment" })
|
||||
export default class LineItemAdjustment extends AdjustmentLine {
|
||||
@ManyToOne(() => LineItem, {
|
||||
export default class OrderLineItemAdjustment extends AdjustmentLine {
|
||||
@ManyToOne(() => OrderLineItem, {
|
||||
persist: false,
|
||||
})
|
||||
item: Rel<LineItem>
|
||||
item: Rel<OrderLineItem>
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => LineItem,
|
||||
entity: () => OrderLineItem,
|
||||
columnType: "text",
|
||||
fieldName: "item_id",
|
||||
onDelete: "cascade",
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
OnInit,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import LineItem from "./line-item"
|
||||
import OrderLineItem from "./line-item"
|
||||
import TaxLine from "./tax-line"
|
||||
|
||||
const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
@@ -19,15 +19,15 @@ const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_line_item_tax_line" })
|
||||
export default class LineItemTaxLine extends TaxLine {
|
||||
@ManyToOne(() => LineItem, {
|
||||
export default class OrderLineItemTaxLine extends TaxLine {
|
||||
@ManyToOne(() => OrderLineItem, {
|
||||
fieldName: "item_id",
|
||||
persist: false,
|
||||
})
|
||||
item: Rel<LineItem>
|
||||
item: Rel<OrderLineItem>
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => LineItem,
|
||||
entity: () => OrderLineItem,
|
||||
columnType: "text",
|
||||
fieldName: "item_id",
|
||||
cascade: [Cascade.PERSIST, Cascade.REMOVE],
|
||||
|
||||
@@ -19,8 +19,8 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import LineItemAdjustment from "./line-item-adjustment"
|
||||
import LineItemTaxLine from "./line-item-tax-line"
|
||||
import OrderLineItemAdjustment from "./line-item-adjustment"
|
||||
import OrderLineItemTaxLine from "./line-item-tax-line"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
@@ -44,7 +44,7 @@ const VariantIdIndex = createPsqlIndexStatementHelper({
|
||||
|
||||
@Entity({ tableName: "order_line_item" })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
export default class LineItem {
|
||||
export default class OrderLineItem {
|
||||
[OptionalProps]?: OptionalLineItemProps
|
||||
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
@@ -128,15 +128,15 @@ export default class LineItem {
|
||||
@Property({ columnType: "jsonb" })
|
||||
raw_unit_price: BigNumberRawValue
|
||||
|
||||
@OneToMany(() => LineItemTaxLine, (taxLine) => taxLine.item, {
|
||||
@OneToMany(() => OrderLineItemTaxLine, (taxLine) => taxLine.item, {
|
||||
cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
|
||||
})
|
||||
tax_lines = new Collection<Rel<LineItemTaxLine>>(this)
|
||||
tax_lines = new Collection<Rel<OrderLineItemTaxLine>>(this)
|
||||
|
||||
@OneToMany(() => LineItemAdjustment, (adjustment) => adjustment.item, {
|
||||
@OneToMany(() => OrderLineItemAdjustment, (adjustment) => adjustment.item, {
|
||||
cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
|
||||
})
|
||||
adjustments = new Collection<Rel<LineItemAdjustment>>(this)
|
||||
adjustments = new Collection<Rel<OrderLineItemAdjustment>>(this)
|
||||
|
||||
@Property({ columnType: "jsonb", nullable: true })
|
||||
metadata: Record<string, unknown> | null = null
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import LineItem from "./line-item"
|
||||
import OrderLineItem from "./line-item"
|
||||
import Order from "./order"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
@@ -71,7 +71,7 @@ export default class OrderItem {
|
||||
version: number
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => LineItem,
|
||||
entity: () => OrderLineItem,
|
||||
fieldName: "item_id",
|
||||
mapToPk: true,
|
||||
columnType: "text",
|
||||
@@ -79,10 +79,10 @@ export default class OrderItem {
|
||||
@ItemIdIndex.MikroORMIndex()
|
||||
item_id: string
|
||||
|
||||
@ManyToOne(() => LineItem, {
|
||||
@ManyToOne(() => OrderLineItem, {
|
||||
persist: false,
|
||||
})
|
||||
item: Rel<LineItem>
|
||||
item: Rel<OrderLineItem>
|
||||
|
||||
@MikroOrmBigNumberProperty()
|
||||
quantity: BigNumber | number
|
||||
|
||||
@@ -17,7 +17,7 @@ import Claim from "./claim"
|
||||
import Exchange from "./exchange"
|
||||
import Order from "./order"
|
||||
import Return from "./return"
|
||||
import ShippingMethod from "./shipping-method"
|
||||
import OrderShippingMethod from "./shipping-method"
|
||||
|
||||
type OptionalShippingMethodProps = DAL.ModelDateColumns
|
||||
|
||||
@@ -65,7 +65,7 @@ const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName })
|
||||
export default class OrderShippingMethod {
|
||||
export default class OrderShipping {
|
||||
[OptionalProps]?: OptionalShippingMethodProps
|
||||
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
@@ -138,7 +138,7 @@ export default class OrderShippingMethod {
|
||||
version: number
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => ShippingMethod,
|
||||
entity: () => OrderShippingMethod,
|
||||
fieldName: "shipping_method_id",
|
||||
mapToPk: true,
|
||||
columnType: "text",
|
||||
@@ -146,10 +146,10 @@ export default class OrderShippingMethod {
|
||||
@ItemIdIndex.MikroORMIndex()
|
||||
shipping_method_id: string
|
||||
|
||||
@ManyToOne(() => ShippingMethod, {
|
||||
@ManyToOne(() => OrderShippingMethod, {
|
||||
persist: false,
|
||||
})
|
||||
shipping_method: Rel<ShippingMethod>
|
||||
shipping_method: Rel<OrderShippingMethod>
|
||||
|
||||
@Property({
|
||||
onCreate: () => new Date(),
|
||||
|
||||
@@ -18,11 +18,11 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import Address from "./address"
|
||||
import OrderAddress from "./address"
|
||||
import OrderItem from "./order-item"
|
||||
import OrderShippingMethod from "./order-shipping-method"
|
||||
import OrderShipping from "./order-shipping-method"
|
||||
import OrderSummary from "./order-summary"
|
||||
import Transaction from "./transaction"
|
||||
import OrderTransaction from "./transaction"
|
||||
|
||||
type OptionalOrderProps =
|
||||
| "shipping_address"
|
||||
@@ -142,24 +142,24 @@ export default class Order {
|
||||
shipping_address_id?: string | null
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => Address,
|
||||
entity: () => OrderAddress,
|
||||
fieldName: "shipping_address_id",
|
||||
nullable: true,
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
shipping_address?: Rel<Address> | null
|
||||
shipping_address?: Rel<OrderAddress> | null
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
@BillingAddressIdIndex.MikroORMIndex()
|
||||
billing_address_id?: string | null
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => Address,
|
||||
entity: () => OrderAddress,
|
||||
fieldName: "billing_address_id",
|
||||
nullable: true,
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
billing_address?: Rel<Address> | null
|
||||
billing_address?: Rel<OrderAddress> | null
|
||||
|
||||
@Property({ columnType: "boolean", nullable: true })
|
||||
no_notification: boolean | null = null
|
||||
@@ -177,19 +177,15 @@ export default class Order {
|
||||
})
|
||||
items = new Collection<Rel<OrderItem>>(this)
|
||||
|
||||
@OneToMany(
|
||||
() => OrderShippingMethod,
|
||||
(shippingMethod) => shippingMethod.order,
|
||||
{
|
||||
cascade: [Cascade.PERSIST],
|
||||
}
|
||||
)
|
||||
shipping_methods = new Collection<Rel<OrderShippingMethod>>(this)
|
||||
|
||||
@OneToMany(() => Transaction, (transaction) => transaction.order, {
|
||||
@OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.order, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<Rel<Transaction>>(this)
|
||||
shipping_methods = new Collection<Rel<OrderShipping>>(this)
|
||||
|
||||
@OneToMany(() => OrderTransaction, (transaction) => transaction.order, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<Rel<OrderTransaction>>(this)
|
||||
|
||||
@Property({
|
||||
onCreate: () => new Date(),
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import LineItem from "./line-item"
|
||||
import OrderLineItem from "./line-item"
|
||||
import Return from "./return"
|
||||
import ReturnReason from "./return-reason"
|
||||
|
||||
@@ -98,7 +98,7 @@ export default class ReturnItem {
|
||||
return: Return
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => LineItem,
|
||||
entity: () => OrderLineItem,
|
||||
fieldName: "item_id",
|
||||
mapToPk: true,
|
||||
columnType: "text",
|
||||
@@ -106,10 +106,10 @@ export default class ReturnItem {
|
||||
@ItemIdIndex.MikroORMIndex()
|
||||
item_id: string
|
||||
|
||||
@ManyToOne(() => LineItem, {
|
||||
@ManyToOne(() => OrderLineItem, {
|
||||
persist: false,
|
||||
})
|
||||
item: LineItem
|
||||
item: OrderLineItem
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
note: string
|
||||
|
||||
@@ -23,11 +23,11 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import { ReturnItem, Transaction } from "@models"
|
||||
import { OrderTransaction, ReturnItem } from "@models"
|
||||
import Claim from "./claim"
|
||||
import Exchange from "./exchange"
|
||||
import Order from "./order"
|
||||
import OrderShippingMethod from "./order-shipping-method"
|
||||
import OrderShipping from "./order-shipping-method"
|
||||
|
||||
type OptionalReturnProps = DAL.ModelDateColumns
|
||||
|
||||
@@ -136,19 +136,15 @@ export default class Return {
|
||||
})
|
||||
items = new Collection<Rel<ReturnItem>>(this)
|
||||
|
||||
@OneToMany(
|
||||
() => OrderShippingMethod,
|
||||
(shippingMethod) => shippingMethod.return,
|
||||
{
|
||||
cascade: [Cascade.PERSIST],
|
||||
}
|
||||
)
|
||||
shipping_methods = new Collection<OrderShippingMethod>(this)
|
||||
|
||||
@OneToMany(() => Transaction, (transaction) => transaction.return, {
|
||||
@OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.return, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<Transaction>(this)
|
||||
shipping_methods = new Collection<OrderShipping>(this)
|
||||
|
||||
@OneToMany(() => OrderTransaction, (transaction) => transaction.return, {
|
||||
cascade: [Cascade.PERSIST],
|
||||
})
|
||||
transactions = new Collection<OrderTransaction>(this)
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
created_by: string | null = null
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
} from "@medusajs/utils"
|
||||
import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core"
|
||||
import AdjustmentLine from "./adjustment-line"
|
||||
import ShippingMethod from "./shipping-method"
|
||||
import OrderShippingMethod from "./shipping-method"
|
||||
|
||||
const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping_method_adjustment",
|
||||
@@ -12,14 +12,14 @@ const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_shipping_method_adjustment" })
|
||||
export default class ShippingMethodAdjustment extends AdjustmentLine {
|
||||
@ManyToOne(() => ShippingMethod, {
|
||||
export default class OrderShippingMethodAdjustment extends AdjustmentLine {
|
||||
@ManyToOne(() => OrderShippingMethod, {
|
||||
persist: false,
|
||||
})
|
||||
shipping_method: Rel<ShippingMethod>
|
||||
shipping_method: Rel<OrderShippingMethod>
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => ShippingMethod,
|
||||
entity: () => OrderShippingMethod,
|
||||
columnType: "text",
|
||||
fieldName: "shipping_method_id",
|
||||
mapToPk: true,
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateEntityId,
|
||||
} from "@medusajs/utils"
|
||||
import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core"
|
||||
import ShippingMethod from "./shipping-method"
|
||||
import OrderShippingMethod from "./shipping-method"
|
||||
import TaxLine from "./tax-line"
|
||||
|
||||
const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
|
||||
@@ -12,14 +12,14 @@ const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_shipping_method_tax_line" })
|
||||
export default class ShippingMethodTaxLine extends TaxLine {
|
||||
@ManyToOne(() => ShippingMethod, {
|
||||
export default class OrderShippingMethodTaxLine extends TaxLine {
|
||||
@ManyToOne(() => OrderShippingMethod, {
|
||||
persist: false,
|
||||
})
|
||||
shipping_method: Rel<ShippingMethod>
|
||||
shipping_method: Rel<OrderShippingMethod>
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => ShippingMethod,
|
||||
entity: () => OrderShippingMethod,
|
||||
fieldName: "shipping_method_id",
|
||||
columnType: "text",
|
||||
mapToPk: true,
|
||||
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import ShippingMethodAdjustment from "./shipping-method-adjustment"
|
||||
import ShippingMethodTaxLine from "./shipping-method-tax-line"
|
||||
import OrderShippingMethodAdjustment from "./shipping-method-adjustment"
|
||||
import OrderShippingMethodTaxLine from "./shipping-method-tax-line"
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping_method",
|
||||
@@ -35,7 +35,7 @@ const ShippingOptionIdIndex = createPsqlIndexStatementHelper({
|
||||
|
||||
@Entity({ tableName: "order_shipping_method" })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
export default class ShippingMethod {
|
||||
export default class OrderShippingMethod {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
|
||||
@@ -68,22 +68,22 @@ export default class ShippingMethod {
|
||||
metadata: Record<string, unknown> | null = null
|
||||
|
||||
@OneToMany(
|
||||
() => ShippingMethodTaxLine,
|
||||
() => OrderShippingMethodTaxLine,
|
||||
(taxLine) => taxLine.shipping_method,
|
||||
{
|
||||
cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
|
||||
}
|
||||
)
|
||||
tax_lines = new Collection<Rel<ShippingMethodTaxLine>>(this)
|
||||
tax_lines = new Collection<Rel<OrderShippingMethodTaxLine>>(this)
|
||||
|
||||
@OneToMany(
|
||||
() => ShippingMethodAdjustment,
|
||||
() => OrderShippingMethodAdjustment,
|
||||
(adjustment) => adjustment.shipping_method,
|
||||
{
|
||||
cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
|
||||
}
|
||||
)
|
||||
adjustments = new Collection<Rel<ShippingMethodAdjustment>>(this)
|
||||
adjustments = new Collection<Rel<OrderShippingMethodAdjustment>>(this)
|
||||
|
||||
@Property({
|
||||
onCreate: () => new Date(),
|
||||
|
||||
@@ -77,7 +77,7 @@ const OrderIdVersionIndex = createPsqlIndexStatementHelper({
|
||||
@Entity({ tableName })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
@OrderIdVersionIndex.MikroORMIndex()
|
||||
export default class Transaction {
|
||||
export default class OrderTransaction {
|
||||
[OptionalProps]?: OptionalLineItemProps
|
||||
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
|
||||
@@ -154,7 +154,7 @@ async function processAdditionalItems(
|
||||
}
|
||||
})
|
||||
|
||||
const createItems = await service.lineItemService_.create(
|
||||
const createItems = await service.orderLineItemService_.create(
|
||||
itemsToAdd,
|
||||
sharedContext
|
||||
)
|
||||
@@ -192,7 +192,7 @@ async function processShippingMethods(
|
||||
let shippingMethodId
|
||||
|
||||
if (!isString(shippingMethod)) {
|
||||
const methods = await service.createShippingMethods(
|
||||
const methods = await service.createOrderShippingMethods(
|
||||
[
|
||||
{
|
||||
...shippingMethod,
|
||||
@@ -207,7 +207,7 @@ async function processShippingMethods(
|
||||
shippingMethodId = shippingMethod
|
||||
}
|
||||
|
||||
const method = await service.retrieveShippingMethod(
|
||||
const method = await service.retrieveOrderShippingMethod(
|
||||
shippingMethodId,
|
||||
{ relations: ["tax_lines", "adjustments"] },
|
||||
sharedContext
|
||||
@@ -243,7 +243,7 @@ async function processReturnShipping(
|
||||
let returnShippingMethodId
|
||||
|
||||
if (!isString(data.return_shipping)) {
|
||||
const methods = await service.createShippingMethods(
|
||||
const methods = await service.createOrderShippingMethods(
|
||||
[
|
||||
{
|
||||
...data.return_shipping,
|
||||
@@ -259,7 +259,7 @@ async function processReturnShipping(
|
||||
returnShippingMethodId = data.return_shipping
|
||||
}
|
||||
|
||||
const method = await service.retrieveShippingMethod(
|
||||
const method = await service.retrieveOrderShippingMethod(
|
||||
returnShippingMethodId,
|
||||
{ relations: ["tax_lines", "adjustments"] },
|
||||
sharedContext
|
||||
|
||||
@@ -121,7 +121,7 @@ async function processAdditionalItems(
|
||||
}
|
||||
})
|
||||
|
||||
const createItems = await service.lineItemService_.create(
|
||||
const createItems = await service.orderLineItemService_.create(
|
||||
itemsToAdd,
|
||||
sharedContext
|
||||
)
|
||||
@@ -161,7 +161,7 @@ async function processShippingMethods(
|
||||
let shippingMethodId
|
||||
|
||||
if (!isString(shippingMethod)) {
|
||||
const methods = await service.createShippingMethods(
|
||||
const methods = await service.createOrderShippingMethods(
|
||||
[
|
||||
{
|
||||
...shippingMethod,
|
||||
@@ -176,7 +176,7 @@ async function processShippingMethods(
|
||||
shippingMethodId = shippingMethod
|
||||
}
|
||||
|
||||
const method = await service.retrieveShippingMethod(
|
||||
const method = await service.retrieveOrderShippingMethod(
|
||||
shippingMethodId,
|
||||
{ relations: ["tax_lines", "adjustments"] },
|
||||
sharedContext
|
||||
@@ -207,7 +207,7 @@ async function processReturnShipping(
|
||||
let returnShippingMethodId
|
||||
|
||||
if (!isString(data.return_shipping)) {
|
||||
const methods = await service.createShippingMethods(
|
||||
const methods = await service.createOrderShippingMethods(
|
||||
[
|
||||
{
|
||||
...data.return_shipping,
|
||||
@@ -223,7 +223,7 @@ async function processReturnShipping(
|
||||
returnShippingMethodId = data.return_shipping
|
||||
}
|
||||
|
||||
const method = await service.retrieveShippingMethod(
|
||||
const method = await service.retrieveOrderShippingMethod(
|
||||
returnShippingMethodId,
|
||||
{ relations: ["tax_lines", "adjustments"] },
|
||||
sharedContext
|
||||
|
||||
@@ -64,7 +64,7 @@ async function processShippingMethod(
|
||||
}
|
||||
|
||||
if (!isString(data.shipping_method)) {
|
||||
const methods = await service.createShippingMethods(
|
||||
const methods = await service.createOrderShippingMethods(
|
||||
[
|
||||
{
|
||||
...data.shipping_method,
|
||||
@@ -79,7 +79,7 @@ async function processShippingMethod(
|
||||
shippingMethodId = data.shipping_method
|
||||
}
|
||||
|
||||
const method = await service.retrieveShippingMethod(
|
||||
const method = await service.retrieveOrderShippingMethod(
|
||||
shippingMethodId,
|
||||
{ relations: ["tax_lines", "adjustments"] },
|
||||
sharedContext
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user