feat(medusa): Products can be added to categories in batch request (#3123)
* wip * chore: fix issues with join table * chore: fix issues * chore: fix ordering issue on random failing test * chore: revert table name * chore: added oas for category * chore: update categories for a product * chore: add remove category test * chore: added changeset * chore: address review comments * chore: Products can be added to categories in batch request * chore: address review comments + add unit specs * chore: make template optional
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
@Entity()
|
||||
@Tree("materialized-path")
|
||||
export class ProductCategory extends SoftDeletableEntity {
|
||||
static productCategoryProductJoinTable = "product_category_product"
|
||||
static treeRelations = ["parent_category", "category_children"]
|
||||
|
||||
@Column()
|
||||
@@ -54,7 +55,7 @@ export class ProductCategory extends SoftDeletableEntity {
|
||||
|
||||
@ManyToMany(() => Product, { cascade: ["remove", "soft-remove"] })
|
||||
@JoinTable({
|
||||
name: "product_category_product",
|
||||
name: ProductCategory.productCategoryProductJoinTable,
|
||||
joinColumn: {
|
||||
name: "product_category_id",
|
||||
referencedColumnName: "id",
|
||||
|
||||
Reference in New Issue
Block a user