fix: the delete of discount
This commit is contained in:
@@ -190,7 +190,12 @@ export class DiscountsService {
|
||||
await this.removeDiscountDeactivationJob(id);
|
||||
await this.clearDirectDiscountFromPlans(discount, queryRunner);
|
||||
|
||||
await queryRunner.manager.softDelete(this.discountRepository.target, discount);
|
||||
// First remove the relationships
|
||||
discount.subscriptionPlans = [];
|
||||
await queryRunner.manager.save(this.discountRepository.target, discount);
|
||||
|
||||
// Then perform the soft delete
|
||||
await queryRunner.manager.softDelete(this.discountRepository.target, { id: discount.id });
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user