feat: 支持任务监控系统

This commit is contained in:
richarjiang
2026-07-15 18:50:12 +08:00
parent f8c8c688a1
commit 4b465843a8
16 changed files with 1389 additions and 29 deletions

View File

@@ -4,6 +4,7 @@ import {
type AvailabilityQuery,
type CancelBookingInput,
type CreateBookingInput,
type CreateMonitorTaskInput,
type TennisBookApi,
type UpdateCourtSettingsInput
} from '../shared/contracts'
@@ -21,7 +22,20 @@ const api: TennisBookApi = {
cancelBooking: (input: CancelBookingInput) =>
ipcRenderer.invoke(IPC_CHANNELS.cancelBooking, input),
getPendingBooking: (courtId: string) =>
ipcRenderer.invoke(IPC_CHANNELS.getPendingBooking, courtId)
ipcRenderer.invoke(IPC_CHANNELS.getPendingBooking, courtId),
listMonitorTasks: () => ipcRenderer.invoke(IPC_CHANNELS.listMonitorTasks),
createMonitorTask: (input: CreateMonitorTaskInput) =>
ipcRenderer.invoke(IPC_CHANNELS.createMonitorTask, input),
setMonitorTaskEnabled: (taskId: string, enabled: boolean) =>
ipcRenderer.invoke(IPC_CHANNELS.setMonitorTaskEnabled, taskId, enabled),
deleteMonitorTask: (taskId: string) =>
ipcRenderer.invoke(IPC_CHANNELS.deleteMonitorTask, taskId),
takeMonitorAlerts: () => ipcRenderer.invoke(IPC_CHANNELS.takeMonitorAlerts),
onMonitorAlert: (listener: () => void) => {
const handler = () => listener()
ipcRenderer.on(IPC_CHANNELS.monitorAlert, handler)
return () => ipcRenderer.removeListener(IPC_CHANNELS.monitorAlert, handler)
}
}
contextBridge.exposeInMainWorld('tennisBook', api)