set schedule to optional in match query and query handler
This commit is contained in:
parent
4fd2950027
commit
6b9bf53b4a
|
@ -165,7 +165,7 @@ export class MatchQueryHandler implements IQueryHandler {
|
|||
frequency: query.frequency,
|
||||
fromDate: query.fromDate,
|
||||
toDate: query.toDate,
|
||||
schedule: query.schedule.map((scheduleItem: ScheduleItem) => ({
|
||||
schedule: query.schedule?.map((scheduleItem: ScheduleItem) => ({
|
||||
day: scheduleItem.day as number,
|
||||
time: scheduleItem.time,
|
||||
margin: scheduleItem.margin as number,
|
||||
|
|
|
@ -21,7 +21,7 @@ export class MatchQuery extends QueryBase {
|
|||
readonly frequency: Frequency;
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
schedule: ScheduleItem[];
|
||||
schedule?: ScheduleItem[];
|
||||
seatsProposed?: number;
|
||||
seatsRequested?: number;
|
||||
strict?: boolean;
|
||||
|
@ -73,7 +73,7 @@ export class MatchQuery extends QueryBase {
|
|||
}
|
||||
|
||||
setMissingMarginDurations = (defaultMarginDuration: number): MatchQuery => {
|
||||
this.schedule.forEach((day: ScheduleItem) => {
|
||||
this.schedule?.forEach((day: ScheduleItem) => {
|
||||
if (day.margin === undefined) day.margin = defaultMarginDuration;
|
||||
});
|
||||
return this;
|
||||
|
@ -136,6 +136,8 @@ export class MatchQuery extends QueryBase {
|
|||
setDatesAndSchedule = (
|
||||
datetimeTransformer: DateTimeTransformerPort,
|
||||
): MatchQuery => {
|
||||
// no transformation if schedule is not set
|
||||
if (this.schedule === undefined) return this;
|
||||
const initialFromDate: string = this.fromDate;
|
||||
this.fromDate = datetimeTransformer.fromDate(
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue