chore: fix interfaces for product module (#5387)

Some changes based on @shahednasser's PR - https://github.com/medusajs/medusa/pull/5341
This commit is contained in:
Riqwan Thamir
2023-10-18 13:38:12 +00:00
committed by GitHub
parent a0963f0edf
commit 453297f525
8 changed files with 280 additions and 152 deletions
@@ -1,3 +1,4 @@
import { DAL } from "@medusajs/types"
import { DALUtils, generateEntityId } from "@medusajs/utils"
import {
BeforeCreate,
@@ -14,7 +15,6 @@ import {
} from "@mikro-orm/core"
import { Product } from "./index"
import ProductOptionValue from "./product-option-value"
import { DAL } from "@medusajs/types"
type OptionalRelations =
| "values"
@@ -39,8 +39,9 @@ class ProductOption {
@ManyToOne(() => Product, {
index: "IDX_product_option_product_id",
fieldName: "product_id",
nullable: true,
})
product: Product
product!: Product
@OneToMany(() => ProductOptionValue, (value) => value.option, {
cascade: [Cascade.REMOVE, "soft-remove" as any],