Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 2x 1x 3x | /**
* Timetable Service
*
* HTTP client for the timetable endpoint — the single authoritative timeline
* for an event, served by TimetableService (backend).
*/
import apiClient from '@/services/api/apiClient';
import type { components } from '@/types/generated/event-sessions-api.types';
export type TimetableSlot = components['schemas']['TimetableSlot'];
export type TimetableResponse = components['schemas']['TimetableResponse'];
export type EventAgendaConfigResponse = components['schemas']['EventAgendaConfigResponse'];
export type UpdateEventAgendaConfigRequest =
components['schemas']['UpdateEventAgendaConfigRequest'];
class TimetableService {
/**
* Get the authoritative timetable for an event.
*
* Returns all slots (MODERATION, BREAK, LUNCH, APERITIF, SPEAKER_SLOT) in chronological order,
* enriched with DB session slugs and assigned speaker session slugs.
*
* GET /api/v1/events/{eventCode}/timetable
*/
async getTimetable(eventCode: string): Promise<TimetableResponse> {
const response = await apiClient.get<TimetableResponse>(`/events/${eventCode}/timetable`);
return response.data;
}
/**
* Get the resolved agenda config for an event (Story 15.2).
*
* Returns the per-event override if present, else the shared event-type template
* (`source` indicates which). GET /api/v1/events/{eventCode}/agenda-config
*/
async getAgendaConfig(eventCode: string): Promise<EventAgendaConfigResponse> {
const response = await apiClient.get<EventAgendaConfigResponse>(
`/events/${eventCode}/agenda-config`
);
return response.data;
}
/**
* Upsert the per-event agenda config override (copy-on-edit; never touches the template).
*
* PUT /api/v1/events/{eventCode}/agenda-config
*/
async updateAgendaConfig(
eventCode: string,
request: UpdateEventAgendaConfigRequest
): Promise<EventAgendaConfigResponse> {
const response = await apiClient.put<EventAgendaConfigResponse>(
`/events/${eventCode}/agenda-config`,
request
);
return response.data;
}
}
export const timetableService = new TimetableService();
|