fix: Cascade remove prices + option values on variant and product delete (#1465)

This commit is contained in:
Kasper Fabricius Kristensen
2022-05-08 16:12:31 +02:00
committed by GitHub
parent e2d08316dd
commit e7cb76ab6e
3 changed files with 174 additions and 3 deletions
@@ -751,7 +751,7 @@ class ProductVariantService extends BaseService {
const variant = await variantRepo.findOne({
where: { id: variantId },
relations: ["prices"],
relations: ["prices", "options"],
})
if (!variant) {
+1 -1
View File
@@ -668,7 +668,7 @@ class ProductService extends BaseService {
// Should not fail, if product does not exist, since delete is idempotent
const product = await productRepo.findOne(
{ id: productId },
{ relations: ["variants"] }
{ relations: ["variants", "variants.prices", "variants.options"] }
)
if (!product) {