diff --git a/license/signatures/version1/cla.json b/license/signatures/version1/cla.json index 46c070085c..922c812dc6 100644 --- a/license/signatures/version1/cla.json +++ b/license/signatures/version1/cla.json @@ -191,6 +191,22 @@ "created_at": "2024-09-30T12:27:50Z", "repoId": 136938012, "pullRequestNo": 3096 + }, + { + "name": "kyunal", + "id": 33372279, + "comment_id": 2395056311, + "created_at": "2024-10-05T13:21:30Z", + "repoId": 136938012, + "pullRequestNo": 3110 + }, + { + "name": "LeftoversTodayAppAdmin", + "id": 139936478, + "comment_id": 2395622489, + "created_at": "2024-10-06T23:06:02Z", + "repoId": 136938012, + "pullRequestNo": 3112 } ] } \ No newline at end of file diff --git a/packages/core/src/plugin/default-search-plugin/default-search-plugin.ts b/packages/core/src/plugin/default-search-plugin/default-search-plugin.ts index 4464a4e25f..fc6a3a6ece 100644 --- a/packages/core/src/plugin/default-search-plugin/default-search-plugin.ts +++ b/packages/core/src/plugin/default-search-plugin/default-search-plugin.ts @@ -19,6 +19,7 @@ import { JobQueueService } from '../../job-queue/job-queue.service'; import { PluginCommonModule } from '../plugin-common.module'; import { VendurePlugin } from '../vendure-plugin'; +import { StockMovementEvent } from '../../event-bus/events/stock-movement-event'; import { stockStatusExtension } from './api/api-extensions'; import { AdminFulltextSearchResolver, ShopFulltextSearchResolver } from './api/fulltext-search.resolver'; import { BUFFER_SEARCH_INDEX_UPDATES, PLUGIN_INIT_OPTIONS } from './constants'; @@ -166,6 +167,13 @@ export class DefaultSearchPlugin implements OnApplicationBootstrap, OnApplicatio } }); + this.eventBus.ofType(StockMovementEvent).subscribe(event => { + return this.searchIndexService.updateVariants( + event.ctx, + event.stockMovements.map(m => m.productVariant), + ); + }); + // TODO: Remove this buffering logic because because we have dedicated buffering based on #1137 const collectionModification$ = this.eventBus.ofType(CollectionModificationEvent); const closingNotifier$ = collectionModification$.pipe(debounceTime(50)); diff --git a/packages/elasticsearch-plugin/src/plugin.ts b/packages/elasticsearch-plugin/src/plugin.ts index 024d40b1f7..a56c6f460e 100644 --- a/packages/elasticsearch-plugin/src/plugin.ts +++ b/packages/elasticsearch-plugin/src/plugin.ts @@ -15,6 +15,7 @@ import { ProductVariantChannelEvent, ProductVariantEvent, SearchJobBufferService, + StockMovementEvent, TaxRateModificationEvent, Type, VendurePlugin, @@ -349,6 +350,13 @@ export class ElasticsearchPlugin implements OnApplicationBootstrap { } }); + this.eventBus.ofType(StockMovementEvent).subscribe(event => { + return this.elasticsearchIndexService.updateVariants( + event.ctx, + event.stockMovements.map(m => m.productVariant), + ); + }); + // TODO: Remove this buffering logic because because we have dedicated buffering based on #1137 const collectionModification$ = this.eventBus.ofType(CollectionModificationEvent); const closingNotifier$ = collectionModification$.pipe(debounceTime(50));