import gql from 'graphql-tag'

export const apolloTheses = {
  query: gql`{
    allQuestions(orderBy: ID_ASC) {
      nodes {
        category: categoryByCategoryId {
          title
        }
        text
        id
      }
    }
  }`,
  update: data => data.allQuestions.nodes.map(node => ({
    id: node.id,
    thesis: {
      de: node.text
    },
    category: {
      de: node.category.title
    }
  }))
}

export const apolloThesesCount = {
  query: gql`{
    allQuestions {
      totalCount
    }
  }`,
  update: data => data.allQuestions.totalCount
}
