mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-04 02:39:14 +02:00
98 implement anonymized DTO events
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Event } from "../model/event.ts";
|
||||
import { AnonymizedEventDTO } from "../model/event.ts";
|
||||
|
||||
export async function fetchRoom(): Promise<string[]> {
|
||||
const rooms: string[] = [];
|
||||
@@ -16,8 +16,8 @@ export async function fetchEventsByRoomAndDuration(
|
||||
room: string,
|
||||
from_date: string,
|
||||
to_date: string,
|
||||
): Promise<Event[]> {
|
||||
const events: Event[] = [];
|
||||
): Promise<AnonymizedEventDTO[]> {
|
||||
const events: AnonymizedEventDTO[] = [];
|
||||
await fetch(
|
||||
"/api/schedule?room=" + room + "&from=" + from_date + "&to=" + to_date,
|
||||
)
|
||||
@@ -27,7 +27,7 @@ export async function fetchEventsByRoomAndDuration(
|
||||
})
|
||||
.then((eventsResponse) => {
|
||||
console.log("Response:", eventsResponse);
|
||||
eventsResponse.forEach((event: Event) => events.push(event));
|
||||
eventsResponse.forEach((event: AnonymizedEventDTO) => events.push(event));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error fetching events: ", error);
|
||||
|
@@ -52,7 +52,7 @@ async function getOccupation() {
|
||||
id: index,
|
||||
start: event.start.replace(/\s\+\d{4}\s\w+$/, "").replace(" ", "T"),
|
||||
end: event.end.replace(/\s\+\d{4}\s\w+$/, "").replace(" ", "T"),
|
||||
showFree: event.name.toLowerCase().includes("zur freien verfügung"),
|
||||
showFree: event.free
|
||||
};
|
||||
});
|
||||
|
||||
|
@@ -14,3 +14,14 @@ export class Event {
|
||||
public week: string,
|
||||
) {}
|
||||
}
|
||||
|
||||
export class AnonymizedEventDTO {
|
||||
constructor(
|
||||
public day: string,
|
||||
public week: string,
|
||||
public start: string,
|
||||
public end: string,
|
||||
public rooms: string,
|
||||
public free: boolean
|
||||
) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user