chore(): Improve internal repository delete algo (#11601)
* chore(): Improve internal repository delete algo * chore(): Improve internal repository delete algo * chore(): Improve internal repository delete algo * update tests * Create purple-donkeys-learn.md * update tests
This commit is contained in:
@@ -272,10 +272,11 @@ export class ProductCategoryRepository extends DALUtils.MikroOrmBaseTreeReposito
|
||||
return [this.sortCategoriesByRank(categoriesTree), count]
|
||||
}
|
||||
|
||||
async delete(ids: string[], context: Context = {}): Promise<void> {
|
||||
async delete(ids: string[], context: Context = {}): Promise<string[]> {
|
||||
const manager = super.getActiveManager<SqlEntityManager>(context)
|
||||
await this.baseDelete(ids, context)
|
||||
await manager.nativeDelete(ProductCategory.name, { id: ids }, {})
|
||||
return ids
|
||||
}
|
||||
|
||||
async softDelete(
|
||||
|
||||
@@ -163,8 +163,8 @@ export default class ProductCategoryService {
|
||||
async delete(
|
||||
ids: string[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
await this.productCategoryRepository_.delete(ids, sharedContext)
|
||||
): Promise<string[]> {
|
||||
return await this.productCategoryRepository_.delete(ids, sharedContext)
|
||||
}
|
||||
|
||||
@InjectTransactionManager("productCategoryRepository_")
|
||||
|
||||
Reference in New Issue
Block a user