Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions backend/src/services/categoryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ export class CategoryService extends LoggerBase {
* @return {Promise<any>} A promise that resolves when the category group is successfully deleted.
*/
async deleteCategoryGroup(categoryGroupId: string) {
const qx = SequelizeRepository.getQueryExecutor(this.options)
return SequelizeRepository.withTx(this.options, async (tx) => {
const qx = SequelizeRepository.getQueryExecutor(this.options, tx)

return deleteCategoryGroup(qx, categoryGroupId)
return deleteCategoryGroup(qx, categoryGroupId)
})
}

/**
Expand Down Expand Up @@ -249,9 +251,11 @@ export class CategoryService extends LoggerBase {
* @return {Promise<any>} A promise that resolves when the category is successfully deleted.
*/
async deleteCategory(categoryId: string) {
const qx = SequelizeRepository.getQueryExecutor(this.options)
return SequelizeRepository.withTx(this.options, async (tx) => {
const qx = SequelizeRepository.getQueryExecutor(this.options, tx)

return deleteCategory(qx, categoryId)
return deleteCategory(qx, categoryId)
})
}

/**
Expand All @@ -261,9 +265,11 @@ export class CategoryService extends LoggerBase {
* @return {Promise<any>} A promise that resolves with the result of the deletion operation.
*/
async deleteCategories(ids: string[]) {
const qx = SequelizeRepository.getQueryExecutor(this.options)
return SequelizeRepository.withTx(this.options, async (tx) => {
const qx = SequelizeRepository.getQueryExecutor(this.options, tx)

return deleteCategories(qx, ids)
return deleteCategories(qx, ids)
})
}

async listCategories(filters: ICategoryFilters) {
Expand Down
Loading