diff --git a/app/fetch_events.ts b/app/fetch_events.ts index 3b0ec8fd68dd08c992bd76cb9e640dc466f2e4f0..a0b985526a99a146f869bcc717319648a6c52a01 100644 --- a/app/fetch_events.ts +++ b/app/fetch_events.ts @@ -60,7 +60,7 @@ const toHoliEvent = (event: AppApiEvent): HoliEvent => { } const buildJasdAppApiUrl = ( - { limit, offset, location, remoteOnly }: FetchEventsInput, + { limit, offset, location, localOnly }: FetchEventsInput, ): URL => { const url = new URL(`${APP_API_BASE_URL}/search`) url.searchParams.append('page', offset.toString()) @@ -71,8 +71,10 @@ const buildJasdAppApiUrl = ( url.searchParams.append('includeExpiredActivities', 'false') url.searchParams.append('permanent', 'false') - if (remoteOnly) { - url.searchParams.append('online', 'true') + if (localOnly) { + url.searchParams.append('online', 'false') + // true is returning only online events + // undefined is returning all } if (location) { @@ -128,8 +130,8 @@ const fetchEventsPage = async ( export type FetchEventsInput = { limit: number offset: number + localOnly: boolean location?: string - remoteOnly?: boolean } export const fetchEvents = async ( diff --git a/app/server.ts b/app/server.ts index c3f674efbd822f6e83e50c9256715364a25a2d13..56c95eae65cd5209de557352c6e571bd50f51d7d 100644 --- a/app/server.ts +++ b/app/server.ts @@ -41,7 +41,7 @@ const SCHEMA = ` type Query { # uses offset-based pagination as described in https://www.apollographql.com/docs/react/pagination/offset-based - events(offset: Int = 0, limit: Int = 5, location: String, remoteOnly: Boolean): EventsResponse! + events(offset: Int = 0, limit: Int = 5, location: String, localOnly: Boolean): EventsResponse! event(id: String!): EventResponse! } ` @@ -50,7 +50,7 @@ export type EventsRequest = { limit?: number offset?: number location?: string - remoteOnly?: boolean + localOnly?: boolean } export type EventRequest = { @@ -69,7 +69,7 @@ const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput => limit: limit, offset: request.offset ?? 0, location: request.location, - remoteOnly: request.remoteOnly, + localOnly: request.localOnly ?? false, } }