Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/api/routes/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type EventsGetRequest = {
Body: undefined;
Querystring?: {
upcomingOnly?: boolean;
featuredOnly?: boolean;
host?: string;
ts?: number;
};
Expand Down Expand Up @@ -123,6 +124,7 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
},
async (request: FastifyRequest<EventsGetRequest>, 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

Expand Down Expand Up @@ -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);
}
Expand Down
Loading