fix(medusa,product): fix ordering product categories (#13487)
CLOSES CORE-1191 cc @SteelRazor47
This commit is contained in:
@@ -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