import { gql } from '@apollo/client'; export interface GetHasCurrentPresentationResponse { pres_page_aggregate: { aggregate: { count: number; }; }; } export interface UserInfo { user: { name: string; userId: string; }; optionDescIds: Array; } export interface ResponseInfo { optionResponsesCount: number; optionDesc: string; pollResponsesCount: number; } export interface PollInfo { published: boolean; pollId: string; secret: boolean; questionText: string; ended: boolean; multipleResponses: boolean; users: Array; responses: Array; users_aggregate: { aggregate: { count: number; }; }; responses_aggregate: { aggregate: { count: number; sum: { optionResponsesCount: number; } }; }; } export interface getCurrentPollDataResponse { poll: Array; } export const getHasCurrentPresentation = gql` subscription getHasCurrentPresentation { pres_page_aggregate(where: {isCurrentPage: {_eq: true}}) { aggregate { count } } } `; export const getCurrentPollData = gql` subscription getCurrentPollData { poll(order_by: {createdAt: desc}, limit: 1,) { pollId published secret questionText ended multipleResponses users(where: {responded: {_eq: true}}) { user { name userId } optionDescIds } responses { optionResponsesCount optionDesc pollResponsesCount } users_aggregate { aggregate { count } } responses_aggregate { aggregate { count sum { optionResponsesCount } } } } } `; export default { getHasCurrentPresentation, };