@@ -146,9 +146,11 @@ export class CategoryService extends LoggerBase {
146146 * @return {Promise<any> } A promise that resolves when the category group is successfully deleted.
147147 */
148148 async deleteCategoryGroup ( categoryGroupId : string ) {
149- const qx = SequelizeRepository . getQueryExecutor ( this . options )
149+ return SequelizeRepository . withTx ( this . options , async ( tx ) => {
150+ const qx = SequelizeRepository . getQueryExecutor ( this . options , tx )
150151
151- return deleteCategoryGroup ( qx , categoryGroupId )
152+ return deleteCategoryGroup ( qx , categoryGroupId )
153+ } )
152154 }
153155
154156 /**
@@ -249,9 +251,11 @@ export class CategoryService extends LoggerBase {
249251 * @return {Promise<any> } A promise that resolves when the category is successfully deleted.
250252 */
251253 async deleteCategory ( categoryId : string ) {
252- const qx = SequelizeRepository . getQueryExecutor ( this . options )
254+ return SequelizeRepository . withTx ( this . options , async ( tx ) => {
255+ const qx = SequelizeRepository . getQueryExecutor ( this . options , tx )
253256
254- return deleteCategory ( qx , categoryId )
257+ return deleteCategory ( qx , categoryId )
258+ } )
255259 }
256260
257261 /**
@@ -261,9 +265,11 @@ export class CategoryService extends LoggerBase {
261265 * @return {Promise<any> } A promise that resolves with the result of the deletion operation.
262266 */
263267 async deleteCategories ( ids : string [ ] ) {
264- const qx = SequelizeRepository . getQueryExecutor ( this . options )
268+ return SequelizeRepository . withTx ( this . options , async ( tx ) => {
269+ const qx = SequelizeRepository . getQueryExecutor ( this . options , tx )
265270
266- return deleteCategories ( qx , ids )
271+ return deleteCategories ( qx , ids )
272+ } )
267273 }
268274
269275 async listCategories ( filters : ICategoryFilters ) {
0 commit comments