owltide/shared/types/schedule.d.ts

66 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-02-26 23:56:19 +01:00
export interface ScheduleEvent {
name: string,
id: string,
crew?: boolean,
2025-02-26 23:56:19 +01:00
host?: string,
cancelled?: boolean,
description?: string,
interested?: number,
2025-02-26 23:56:19 +01:00
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,
2025-02-26 23:56:19 +01:00
}
2025-03-10 20:58:33 +01:00
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[],
2025-03-10 20:58:33 +01:00
}
2025-02-26 23:56:19 +01:00
export interface Schedule {
locations: ScheduleLocation[],
events: ScheduleEvent[],
2025-03-10 20:58:33 +01:00
roles?: Role[],
rota?: Shift[],
2025-02-26 23:56:19 +01:00
}
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>[],
}