Changing recurringReservations to schedule a reservation for 1 week in advance
This commit is contained in:
parent
528fac9a15
commit
c26868a49a
2 changed files with 4 additions and 2 deletions
|
|
@ -46,17 +46,19 @@ export class RecurringReservation {
|
||||||
opponentName: string
|
opponentName: string
|
||||||
|
|
||||||
@Exclude()
|
@Exclude()
|
||||||
public createReservation(): Reservation {
|
public createReservationInAdvance(daysInAdvance = 7): Reservation {
|
||||||
const [hourStart, minuteStart] = this.timeStart.split(':')
|
const [hourStart, minuteStart] = this.timeStart.split(':')
|
||||||
const [hourEnd, minuteEnd] = this.timeEnd.split(':')
|
const [hourEnd, minuteEnd] = this.timeEnd.split(':')
|
||||||
const dateRangeStart = dayjs()
|
const dateRangeStart = dayjs()
|
||||||
.set('day', this.dayOfWeek)
|
.set('day', this.dayOfWeek)
|
||||||
.set('hour', Number.parseInt(hourStart))
|
.set('hour', Number.parseInt(hourStart))
|
||||||
.set('minute', Number.parseInt(minuteStart))
|
.set('minute', Number.parseInt(minuteStart))
|
||||||
|
.add(daysInAdvance, 'days')
|
||||||
const dateRangeEnd = dayjs()
|
const dateRangeEnd = dayjs()
|
||||||
.set('day', this.dayOfWeek)
|
.set('day', this.dayOfWeek)
|
||||||
.set('hour', Number.parseInt(hourEnd))
|
.set('hour', Number.parseInt(hourEnd))
|
||||||
.set('minute', Number.parseInt(minuteEnd))
|
.set('minute', Number.parseInt(minuteEnd))
|
||||||
|
.add(daysInAdvance, 'days')
|
||||||
const reservation = new Reservation({
|
const reservation = new Reservation({
|
||||||
username: this.username,
|
username: this.username,
|
||||||
password: this.password,
|
password: this.password,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export class RecurringReservationsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleReservation(recurringReservation: RecurringReservation) {
|
scheduleReservation(recurringReservation: RecurringReservation) {
|
||||||
const reservation = recurringReservation.createReservation()
|
const reservation = recurringReservation.createReservationInAdvance()
|
||||||
return this.reservationsService.create(reservation)
|
return this.reservationsService.create(reservation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue