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,
|
frequency: query.frequency,
|
||||||
fromDate: query.fromDate,
|
fromDate: query.fromDate,
|
||||||
toDate: query.toDate,
|
toDate: query.toDate,
|
||||||
schedule: query.schedule.map((scheduleItem: ScheduleItem) => ({
|
schedule: query.schedule?.map((scheduleItem: ScheduleItem) => ({
|
||||||
day: scheduleItem.day as number,
|
day: scheduleItem.day as number,
|
||||||
time: scheduleItem.time,
|
time: scheduleItem.time,
|
||||||
margin: scheduleItem.margin as number,
|
margin: scheduleItem.margin as number,
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class MatchQuery extends QueryBase {
|
||||||
readonly frequency: Frequency;
|
readonly frequency: Frequency;
|
||||||
fromDate: string;
|
fromDate: string;
|
||||||
toDate: string;
|
toDate: string;
|
||||||
schedule: ScheduleItem[];
|
schedule?: ScheduleItem[];
|
||||||
seatsProposed?: number;
|
seatsProposed?: number;
|
||||||
seatsRequested?: number;
|
seatsRequested?: number;
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
|
@ -73,7 +73,7 @@ export class MatchQuery extends QueryBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMissingMarginDurations = (defaultMarginDuration: number): MatchQuery => {
|
setMissingMarginDurations = (defaultMarginDuration: number): MatchQuery => {
|
||||||
this.schedule.forEach((day: ScheduleItem) => {
|
this.schedule?.forEach((day: ScheduleItem) => {
|
||||||
if (day.margin === undefined) day.margin = defaultMarginDuration;
|
if (day.margin === undefined) day.margin = defaultMarginDuration;
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
|
@ -136,6 +136,8 @@ export class MatchQuery extends QueryBase {
|
||||||
setDatesAndSchedule = (
|
setDatesAndSchedule = (
|
||||||
datetimeTransformer: DateTimeTransformerPort,
|
datetimeTransformer: DateTimeTransformerPort,
|
||||||
): MatchQuery => {
|
): MatchQuery => {
|
||||||
|
// no transformation if schedule is not set
|
||||||
|
if (this.schedule === undefined) return this;
|
||||||
const initialFromDate: string = this.fromDate;
|
const initialFromDate: string = this.fromDate;
|
||||||
this.fromDate = datetimeTransformer.fromDate(
|
this.fromDate = datetimeTransformer.fromDate(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue