Fix/cascading product variant deletion (#570)
* testing for deletes of variants when a product is deleted * remove variants with products * test using direct db query * formatting * removed unused imports
This commit is contained in:
1 parent
b0226b1975
commit
6b83653bf6
2 files changed
+45
-6
No files matched your search
@@ -468,7 +468,10 @@ class ProductService extends BaseService {
|
||||
const productRepo = manager.getCustomRepository(this.productRepository_)
|
||||
|
||||
// Should not fail, if product does not exist, since delete is idempotent
|
||||
const product = await productRepo.findOne({ where: { id: productId } })
|
||||
const product = await productRepo.findOne(
|
||||
{ id: productId },
|
||||
{ relations: ["variants"] }
|
||||
)
|
||||
|
||||
if (!product) return Promise.resolve()
|
||||
|
||||
|
||||
Reference in new issue
Block a user