extend calendar link

This commit is contained in:
Julian Krauser 2024-12-24 14:06:48 +01:00
parent 020ae4a939
commit e9b29f8acf
2 changed files with 14 additions and 4 deletions

View file

@ -16,6 +16,7 @@ import CalendarFactory from "../factory/admin/calendar";
*/
export async function getCalendarItemsByTypes(req: Request, res: Response): Promise<any> {
let types = Array.isArray(req.query.types) ? req.query.types : [req.query.types];
let nscdr = req.query.nscdr == "true";
let output = (req.query.output as "ics" | "json") ?? "ics";
if (output != "ics" && output != "json") {
@ -33,7 +34,10 @@ export async function getCalendarItemsByTypes(req: Request, res: Response): Prom
ti.passphrase == "" ||
ti.passphrase == (types as Array<string>).find((t) => t.includes(ti.type)).split(":")[1]
);
items = await CalendarService.getByTypes(typeIds.map((t) => t.id));
items = await CalendarService.getByTypes(
typeIds.map((t) => t.id),
nscdr
);
} else {
items = await CalendarService.getByTypeNSCDR();
}