chore(): Reorganize modules (#7210)

**What**
Move all modules to the modules directory
This commit is contained in:
Adrien de Peretti
2024-05-02 17:33:34 +02:00
committed by GitHub
parent 7a351eef09
commit 4eae25e1ef
870 changed files with 91 additions and 62 deletions

View File

@@ -0,0 +1,42 @@
import {
createPsqlIndexStatementHelper,
generateEntityId,
} from "@medusajs/utils"
import { BeforeCreate, Entity, ManyToOne, OnInit } from "@mikro-orm/core"
import AdjustmentLine from "./adjustment-line"
import ShippingMethod from "./shipping-method"
const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
tableName: "order_shipping_method_adjustment",
columns: "shipping_method_id",
})
@Entity({ tableName: "order_shipping_method_adjustment" })
export default class ShippingMethodAdjustment extends AdjustmentLine {
@ManyToOne(() => ShippingMethod, {
persist: false,
})
shipping_method: ShippingMethod
@ManyToOne({
entity: () => ShippingMethod,
columnType: "text",
fieldName: "shipping_method_id",
mapToPk: true,
onDelete: "cascade",
})
@ShippingMethodIdIdIndex.MikroORMIndex()
shipping_method_id: string
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "ordsmadj")
this.shipping_method_id ??= this.shipping_method?.id
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "ordsmadj")
this.shipping_method_id ??= this.shipping_method?.id
}
}