kandimat/redaktions-app/src/backend/queries/question.ts
2020-12-29 19:53:27 +01:00

52 lines
930 B
TypeScript

import {gql} from "@apollo/client";
const QuestionCategoryFragment = gql`
fragment QuestionCategoryFragment on Category {
id
rowId
title
}
`
interface GetQuestionsCategoryResponse {
id: string,
rowId: number,
title: string,
}
export const BasicQuestionFragment = gql`
fragment BasicQuestionFragment on Question {
id
title
description
categoryByCategoryRowId {
...QuestionCategoryFragment
}
}
${QuestionCategoryFragment}
`
export interface BasicQuestionResponse {
id: string,
title: string,
description: string | null,
categoryByCategoryRowId: GetQuestionsCategoryResponse | null
}
export const GET_ALL_QUESTIONS = gql`
query AllQuestions {
allQuestions {
nodes {
...BasicQuestionFragment
}
}
}
${BasicQuestionFragment}
`
export interface GetAllQuestionsResponse {
allQuestions: {
nodes: Array<BasicQuestionResponse>
}
}