Fixing some errors due to changing reservation requests
This commit is contained in:
parent
3247ca5315
commit
c7d9bef9f0
1 changed files with 7 additions and 6 deletions
13
src/local.ts
13
src/local.ts
|
|
@ -1,14 +1,13 @@
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { v4 } from 'uuid'
|
import { v4 } from 'uuid'
|
||||||
import { Logger, LogLevel } from './common/logger'
|
import { Logger, LogLevel } from './common/logger'
|
||||||
import { ReservationRequest } from './common/request'
|
|
||||||
import { Reservation } from './common/reservation'
|
import { Reservation } from './common/reservation'
|
||||||
import { Runner } from './common/runner'
|
import { Runner } from './common/runner'
|
||||||
|
|
||||||
const run = async (request: ReservationRequest) => {
|
const run = async (request: Record<string, any>) => {
|
||||||
Logger.instantiate('local', v4(), LogLevel.DEBUG)
|
Logger.instantiate('local', v4(), LogLevel.DEBUG)
|
||||||
const { username, password, dateRange, opponent } = request
|
const { user, dateRange, opponent } = request
|
||||||
const reservation = new Reservation({ username, password }, dateRange, opponent)
|
const reservation = new Reservation(user, dateRange, opponent)
|
||||||
|
|
||||||
const runner = new Runner(username, password, [reservation])
|
const runner = new Runner(username, password, [reservation])
|
||||||
await runner.run({ headless: false })
|
await runner.run({ headless: false })
|
||||||
|
|
@ -40,8 +39,10 @@ const [startHour, startMinute] = startTime
|
||||||
const [endHour, endMinute] = endTime.split(':').map((t) => Number.parseInt(t))
|
const [endHour, endMinute] = endTime.split(':').map((t) => Number.parseInt(t))
|
||||||
|
|
||||||
run({
|
run({
|
||||||
username: username,
|
user: {
|
||||||
password: password,
|
username: username,
|
||||||
|
password: password,
|
||||||
|
},
|
||||||
dateRange: {
|
dateRange: {
|
||||||
start: dayjs(`${year}-${month}-${day}T${startHour}:${startMinute}`),
|
start: dayjs(`${year}-${month}-${day}T${startHour}:${startMinute}`),
|
||||||
end: dayjs(`${year}-${month}-${day}T${endHour}:${endMinute}`),
|
end: dayjs(`${year}-${month}-${day}T${endHour}:${endMinute}`),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue