From 73bc690080ba9ae3f03a923de0020916e20859db Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 21 Apr 2023 16:42:01 +0200 Subject: [PATCH] Adapted the calendar to work with the current API --- webclient/src/api_types/index.ts | 11 +++++++++++ webclient/src/components/CalendarModal.vue | 12 ++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/webclient/src/api_types/index.ts b/webclient/src/api_types/index.ts index 13fd0ffb5..aa83c7847 100644 --- a/webclient/src/api_types/index.ts +++ b/webclient/src/api_types/index.ts @@ -580,8 +580,19 @@ export type components = { * @example 2018-01-01T00:00:00 */ readonly last_sync: string; + /** + * @description Link to the same calendar, but in TUMonline + * @example https://campus.tum.de/tumonline/wbKalender.wbRessource?pResNr=12543 + */ + readonly calendar_url: string; }; readonly CalendarEntry: { + /** + * Format: int32 + * @description The id of the calendar entry used in TUMonline internally + * @example 42 + */ + readonly id: number; /** * @description The title of the Entry * @example Quantenteleportation diff --git a/webclient/src/components/CalendarModal.vue b/webclient/src/components/CalendarModal.vue index 134ba22ad..a3dbde5f7 100644 --- a/webclient/src/components/CalendarModal.vue +++ b/webclient/src/components/CalendarModal.vue @@ -15,7 +15,7 @@ const global = useGlobalStore(); const showDate = ref(new Date()); const tumonlineCalendarUrl = ref("https://campus.tum.de/tumonline"); -const lastmod = ref("xx.xx.xxxx xx:xx"); +const last_sync = ref("xx.xx.xxxx xx:xx"); const events = ref([]); const route = useRoute(); @@ -38,17 +38,17 @@ function update() { useFetch(`/api/calendar/${route.params.id}?start=${startString}&end=${endString}`, (d) => { console.log(d); tumonlineCalendarUrl.value = d.calendar_url; - lastmod.value = d.lastmod; - events.value = d.events.map((e) => ({ + last_sync.value = d.last_sync; + events.value = d.entries.map((e) => ({ id: e.id, title: e.title, startDate: new Date(e.start), endDate: new Date(e.end), - classes: e.classes, + classes: [e.entry_type], })); }); } -function setShowDate(d) { +function setShowDate(d: Date) { showDate.value = d; } @@ -78,7 +78,7 @@ function setShowDate(d) {