diff --git a/src/modules/ad/core/application/queries/match/match.query.ts b/src/modules/ad/core/application/queries/match/match.query.ts index 937ed4c..e9d1b6e 100644 --- a/src/modules/ad/core/application/queries/match/match.query.ts +++ b/src/modules/ad/core/application/queries/match/match.query.ts @@ -42,6 +42,7 @@ export class MatchQuery extends QueryBase { private readonly originWaypoint: Waypoint; routeProvider: RouteProviderPort; + // TODO: remove MatchRequestDto depency (here core domain depends on interface /!\) constructor(props: MatchRequestDto, routeProvider: RouteProviderPort) { super(); this.id = props.id; diff --git a/src/modules/ad/core/domain/candidate.entity.ts b/src/modules/ad/core/domain/candidate.entity.ts index ec3a7c9..434fe05 100644 --- a/src/modules/ad/core/domain/candidate.entity.ts +++ b/src/modules/ad/core/domain/candidate.entity.ts @@ -53,13 +53,18 @@ export class CandidateEntity extends AggregateRoot { * This is a tedious process : additional information can be found in deeper methods ! */ createJourneys = (): CandidateEntity => { - this.props.journeys = this.props.driverSchedule - // first we create the journeys - .map((driverScheduleItem: ScheduleItem) => - this._createJourney(driverScheduleItem), - ) - // then we filter the ones with invalid pickups - .filter((journey: Journey) => journey.hasValidPickUp()); + try { + this.props.journeys = this.props.driverSchedule + // first we create the journeys + .map((driverScheduleItem: ScheduleItem) => + this._createJourney(driverScheduleItem), + ) + // then we filter the ones with invalid pickups + .filter((journey: Journey) => journey.hasValidPickUp()); + } catch (e) { + // irrelevant journeys fall here + // eg. no available day for the given date range + } return this; };