What: - Adds PriceSet, PriceSetMoneyAmount, updates schema - Adds service/repo for PriceSet - Shifts entry point to use PriceSet - Updates link/joiner config RESOLVES CORE-1495
29 lines
586 B
TypeScript
29 lines
586 B
TypeScript
import { generateEntityId } from "@medusajs/utils"
|
|
import {
|
|
BeforeCreate,
|
|
Collection,
|
|
Entity,
|
|
ManyToMany,
|
|
PrimaryKey,
|
|
} from "@mikro-orm/core"
|
|
|
|
import MoneyAmount from "./money-amount"
|
|
import PriceSetMoneyAmount from "./price-set-money-amount"
|
|
|
|
@Entity()
|
|
export default class PriceSet {
|
|
@PrimaryKey({ columnType: "text" })
|
|
id!: string
|
|
|
|
@ManyToMany({
|
|
entity: () => MoneyAmount,
|
|
pivotEntity: () => PriceSetMoneyAmount,
|
|
})
|
|
money_amounts = new Collection<MoneyAmount>(this)
|
|
|
|
@BeforeCreate()
|
|
onCreate() {
|
|
this.id = generateEntityId(this.id, "pset")
|
|
}
|
|
}
|