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:
Riqwan Thamir
2023-01-27 15:58:58 +01:00
committed by GitHub
parent ee42b60a20
commit 4f0d8992a0
11 changed files with 393 additions and 37 deletions
@@ -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",