owltide/shared/types/schedule.d.ts
Hornwitser 5255ed698e Implement access controlled edit schedule endpoint
Add PATCH /api/schedule endpoint for editing the schedule in a manner
that's access controlled.
2025-03-11 14:11:05 +01:00

63 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[],
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,
}
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>[],
}