From e2bb991c1cf58ea16189200626908e17fc79315a Mon Sep 17 00:00:00 2001 From: NextFire Date: Wed, 11 Sep 2024 11:17:09 +0200 Subject: [PATCH] api/calendar: use aggregate endpoint --- components/Projection.vue | 20 ++++++++++--------- server/api/calendars/[user].get.ts | 32 ++---------------------------- server/utils/nanapi-client.ts | 5 ++++- 3 files changed, 17 insertions(+), 40 deletions(-) diff --git a/components/Projection.vue b/components/Projection.vue index e1ae481..9bc2074 100644 --- a/components/Projection.vue +++ b/components/Projection.vue @@ -4,15 +4,17 @@ import uniqolor from "uniqolor"; const props = defineProps<{ projection: Projection }>(); -const eventSources = props.projection.participants.map( - (p) => - ({ - id: p.discord_username, - url: `/api/calendars/${p.discord_id_str}`, - format: "ics", - color: uniqolor(p.id).color, - } satisfies EventSourceInput) -); +const eventSources = props.projection.participants + .toSorted((a, b) => a.discord_username.localeCompare(b.discord_username)) + .map( + (p) => + ({ + id: p.discord_username, + url: `/api/calendars/${p.discord_id_str}`, + format: "ics", + color: uniqolor(p.id).color, + } satisfies EventSourceInput) + );