From 4731020e8ad2448442bb9ab0eb898f38ef3c91c9 Mon Sep 17 00:00:00 2001 From: sbriat Date: Tue, 12 Sep 2023 15:10:32 +0200 Subject: [PATCH] fix wrong id for ad creation --- .../ad/core/application/queries/match/algorithm.abstract.ts | 1 - .../ad/interface/message-handlers/ad-created.message-handler.ts | 2 +- src/modules/ad/interface/message-handlers/ad.types.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/ad/core/application/queries/match/algorithm.abstract.ts b/src/modules/ad/core/application/queries/match/algorithm.abstract.ts index 93a4cda..f993730 100644 --- a/src/modules/ad/core/application/queries/match/algorithm.abstract.ts +++ b/src/modules/ad/core/application/queries/match/algorithm.abstract.ts @@ -20,7 +20,6 @@ export abstract class Algorithm { for (const processor of this.processors) { this.candidates = await processor.execute(this.candidates); } - // console.log(this.candidates); return this.candidates.map((candidate: CandidateEntity) => MatchEntity.create({ adId: candidate.id }), ); diff --git a/src/modules/ad/interface/message-handlers/ad-created.message-handler.ts b/src/modules/ad/interface/message-handlers/ad-created.message-handler.ts index 621c6a1..9e7aa88 100644 --- a/src/modules/ad/interface/message-handlers/ad-created.message-handler.ts +++ b/src/modules/ad/interface/message-handlers/ad-created.message-handler.ts @@ -16,7 +16,7 @@ export class AdCreatedMessageHandler { const createdAd: Ad = JSON.parse(message); await this.commandBus.execute( new CreateAdCommand({ - id: createdAd.id, + id: createdAd.aggregateId, driver: createdAd.driver, passenger: createdAd.passenger, frequency: createdAd.frequency, diff --git a/src/modules/ad/interface/message-handlers/ad.types.ts b/src/modules/ad/interface/message-handlers/ad.types.ts index 5bc7e88..45eb53b 100644 --- a/src/modules/ad/interface/message-handlers/ad.types.ts +++ b/src/modules/ad/interface/message-handlers/ad.types.ts @@ -1,7 +1,7 @@ import { Frequency } from '@modules/ad/core/domain/ad.types'; export type Ad = { - id: string; + aggregateId: string; driver: boolean; passenger: boolean; frequency: Frequency;