Feat:contentful plugin archive on delete

* extend plugin with methods for archival in contentful

* add events to services

* rename entities

* eventbusservice to delete

* Update packages/medusa-plugin-contentful/src/services/contentful.js

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* Update packages/medusa-plugin-contentful/src/services/contentful.js

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* Update packages/medusa-plugin-contentful/src/services/contentful.js

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* testing

* adjust options

* Update packages/medusa-plugin-contentful/src/services/contentful.js

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* adjust options

* Update packages/medusa-plugin-contentful/src/services/contentful.js

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* Update packages/medusa-plugin-contentful/src/services/contentful.js

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
Philip KorsholmandSebastian Rindom authored and GitHub committed 2021-10-14 17:00:27 +02:00
1 parent 62fda1043e
commit ba2de6906a
9 files changed
+319 -4

No files matched your search

@@ -415,6 +415,7 @@ describe("ProductService", () => {
const productService = new ProductService({
manager: MockManager,
eventBusService,
productRepository,
})
@@ -11,6 +11,7 @@ class ProductVariantService extends BaseService {
static Events = {
UPDATED: "product-variant.updated",
CREATED: "product-variant.created",
DELETED: "product-variant.deleted",
}
/** @param { productVariantModel: (ProductVariantModel) } */
@@ -588,6 +589,12 @@ class ProductVariantService extends BaseService {
await variantRepo.softRemove(variant)
await this.eventBus_
.withTransaction(manager)
.emit(ProductVariantService.Events.DELETED, {
id: variantId,
})
return Promise.resolve()
})
}
+7
View File
@@ -11,6 +11,7 @@ class ProductService extends BaseService {
static Events = {
UPDATED: "product.updated",
CREATED: "product.created",
DELETED: "product.deleted",
}
constructor({
@@ -475,6 +476,12 @@ class ProductService extends BaseService {
await productRepo.softRemove(product)
await this.eventBus_
.withTransaction(manager)
.emit(ProductService.Events.DELETED, {
id: productId,
})
return Promise.resolve()
})
}
+7
View File
@@ -10,6 +10,7 @@ class RegionService extends BaseService {
static Events = {
UPDATED: "region.updated",
CREATED: "region.created",
DELETED: "region.deleted",
}
constructor({
@@ -389,6 +390,12 @@ class RegionService extends BaseService {
await regionRepo.softRemove(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.DELETED, {
id: regionId,
})
return Promise.resolve()
})
}