fix(medusa,product): fix ordering product categories (#13487)
CLOSES CORE-1191 cc @SteelRazor47
This commit is contained in:
1 parent
75e85414cc
commit
4fded2602b
5 files changed
+40
-27
No files matched your search
@@ -6,7 +6,7 @@ import {
|
||||
ProductTypes,
|
||||
} from "@medusajs/framework/types"
|
||||
import { DALUtils, isDefined, MedusaError } from "@medusajs/framework/utils"
|
||||
import { LoadStrategy, FindOptions as MikroOptions } from "@mikro-orm/core"
|
||||
import { FindOptions as MikroOptions, LoadStrategy } from "@mikro-orm/core"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { ProductCategory } from "@models"
|
||||
import { UpdateCategoryInput } from "@types"
|
||||
@@ -21,10 +21,9 @@ export class ProductCategoryRepository extends DALUtils.MikroOrmBaseTreeReposito
|
||||
) {
|
||||
const findOptions_ = { ...findOptions }
|
||||
findOptions_.options ??= {}
|
||||
findOptions_.options.orderBy = {
|
||||
findOptions_.options.orderBy ??= {
|
||||
id: "ASC",
|
||||
rank: "ASC",
|
||||
...findOptions_.options.orderBy,
|
||||
}
|
||||
|
||||
const fields = (findOptions_.options.fields ??= [])
|
||||
|
||||
Reference in new issue
Block a user