owltide/shared/types/schedule.d.ts

65 lines
1.1 KiB
TypeScript

export interface ScheduleEvent {
name: string,
id: string,
crew?: boolean,
host?: string,
cancelled?: boolean,
description?: string,
interested?: number,
slots: TimeSlot[],
}
export interface ScheduleLocation {
name: string,
id: string,
description?: string,
}
export interface TimeSlot {
id: string,
start: string,
end: string,
locations: string[],
assigned?: number[],
interested?: number,
}
export interface Shift {
name: string,
id: string,
role: string,
description?: string,
slots: ShiftSlot[],
}
export interface Role {
name: string,
id: string,
description?: string,
}
export interface ShiftSlot {
id: string,
start: string,
end: string,
assigned?: number[],
}
export interface Schedule {
locations: ScheduleLocation[],
events: ScheduleEvent[],
roles?: Role[],
rota?: Shift[],
}
export type ChangeRecord<T extends { id: string }> =
| { op: "set", data: T }
| { op: "del", data: { id: string }}
;
export interface SchedulePatch {
locations?: ChangeRecord<ScheduleLocation>[],
events?: ChangeRecord<ScheduleEvent>[],
roles?: ChangeRecord<Role>[],
rota?: ChangeRecord<Shift>[],
}