diff --git a/src/modules/event/index.ts b/src/modules/event/index.ts index 1583c4f..f67ec3b 100644 --- a/src/modules/event/index.ts +++ b/src/modules/event/index.ts @@ -13,6 +13,7 @@ import { GetEventResponse, OrderBy, EventTypeInterface, + getParticipantsByEventIdProps, } from '../../types'; import { CREATE_EVENT_MUTATION } from '../../mutations'; @@ -56,14 +57,19 @@ export class Event { return response.data.eventTypes.data; } - public async getParticipantsByEventId( - eventId: string - ): Promise { + public async getParticipantsByEventId({ + eventId, + first, + page, + }: getParticipantsByEventIdProps): Promise { + const where = { + column: 'EVENT_VERSION_ID', + operator: 'EQ', + value: eventId, + }; const { data } = await this.client.query({ query: EVENT_PARTICIPANTS_QUERY, - variables: { - where: { column: 'EVENT_VERSION_ID', operator: 'EQ', value: eventId }, - }, + variables: { where, first, page }, fetchPolicy: 'network-only', partialRefetch: true, }); diff --git a/src/queries/event.query.ts b/src/queries/event.query.ts index 3fd2a8e..7960612 100644 --- a/src/queries/event.query.ts +++ b/src/queries/event.query.ts @@ -50,9 +50,11 @@ export const EVENT_TYPES_QUERY = gql` export const EVENT_PARTICIPANTS_QUERY = gql` query EventVersionParticipants( + $first: Int + $page: Int $where: QueryEventVersionParticipantsWhereWhereConditions ) { - eventVersionParticipants(where: $where) { + eventVersionParticipants(first: $first, page: $page, where: $where) { data { participant { id diff --git a/src/types/events.ts b/src/types/events.ts index 9be4031..d762f5a 100644 --- a/src/types/events.ts +++ b/src/types/events.ts @@ -67,6 +67,12 @@ export type GetParticipantsByEventId = { paginatorInfo?: PaginatorInfo; }[]; +export type getParticipantsByEventIdProps = { + eventId?: number | undefined; + first?: number; + page?: number; +} + export interface EventCategoryInterface { id: string; name: string;