feat(medusa): categories can be ranked based on position (#3341)
* chore: categories can be ranked based on position * chore: fix tests * chore: sort categories by order * chore: fix bug where mpath relationship is messed up * chore: enable linting - lint changes * Update packages/medusa/src/repositories/product-category.ts Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com> * chore: fixed specs * chore: cleanup repository to new typeorm interfaces + cleanup * chore: revert repository changes due to incorrect sql * chore: addressed pr reviews --------- Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com> Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
This commit is contained in:
co-authored by
Frane Polić
adrien2p
parent
67ba8be02b
commit
0a6aa0e624
@@ -29,23 +29,27 @@ describe("Product Categories", () => {
|
||||
beforeEach(async () => {
|
||||
a1 = await simpleProductCategoryFactory(dbConnection, {
|
||||
name: 'a1',
|
||||
is_active: true
|
||||
is_active: true,
|
||||
rank: 0,
|
||||
})
|
||||
a11 = await simpleProductCategoryFactory(dbConnection, {
|
||||
name: 'a11',
|
||||
parent_category: a1,
|
||||
is_active: true
|
||||
is_active: true,
|
||||
rank: 0,
|
||||
})
|
||||
a111 = await simpleProductCategoryFactory(dbConnection, {
|
||||
name: 'a111',
|
||||
parent_category: a11,
|
||||
is_active: true,
|
||||
is_internal: true
|
||||
is_internal: true,
|
||||
rank: 0,
|
||||
})
|
||||
a12 = await simpleProductCategoryFactory(dbConnection, {
|
||||
name: 'a12',
|
||||
parent_category: a1,
|
||||
is_active: false
|
||||
is_active: false,
|
||||
rank: 1,
|
||||
})
|
||||
|
||||
productCategoryRepository = dbConnection.manager.withRepository(ProductCategoryRepository)
|
||||
@@ -103,7 +107,8 @@ describe("Product Categories", () => {
|
||||
dbConnection, {
|
||||
name: 'skinny jeans',
|
||||
handle: 'skinny-jeans',
|
||||
is_active: true
|
||||
is_active: true,
|
||||
rank: 0,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -112,7 +117,8 @@ describe("Product Categories", () => {
|
||||
name: 'winter shirts',
|
||||
handle: 'winter-shirts',
|
||||
parent_category: a1,
|
||||
is_active: true
|
||||
is_active: true,
|
||||
rank: 0,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -120,7 +126,8 @@ describe("Product Categories", () => {
|
||||
dbConnection, {
|
||||
name: 'running shoes',
|
||||
handle: 'running-shoes',
|
||||
parent_category: a11
|
||||
parent_category: a11,
|
||||
rank: 0,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -129,7 +136,8 @@ describe("Product Categories", () => {
|
||||
name: 'casual shoes',
|
||||
handle: 'casual-shoes',
|
||||
parent_category: a1,
|
||||
is_internal: true
|
||||
is_internal: true,
|
||||
rank: 1,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user