From 90c2738f7b1e28fc51b4adecb8d2c7278843a431 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 15 Apr 2025 23:34:13 +0000 Subject: [PATCH] support featuredOnly parameter for getting events --- src/api/routes/events.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/routes/events.ts b/src/api/routes/events.ts index e617cd74..89338fe1 100644 --- a/src/api/routes/events.ts +++ b/src/api/routes/events.ts @@ -94,6 +94,7 @@ type EventsGetRequest = { Body: undefined; Querystring?: { upcomingOnly?: boolean; + featuredOnly?: boolean; host?: string; ts?: number; }; @@ -123,6 +124,7 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => { }, async (request: FastifyRequest, reply) => { const upcomingOnly = request.query?.upcomingOnly || false; + const featuredOnly = request.query?.featuredOnly || false; const host = request.query?.host; const ts = request.query?.ts; // we only use this to disable cache control @@ -205,6 +207,9 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => { } }); } + if (featuredOnly) { + parsedItems = parsedItems.filter((x) => x.featured); + } if (!ts) { reply.header("Cache-Control", CLIENT_HTTP_CACHE_POLICY); }