587c0cdeba
Also: * introduce __typename to all response types
76 lines
1.7 KiB
TypeScript
76 lines
1.7 KiB
TypeScript
import {gql} from "@apollo/client";
|
|
import {BasicQuestionFragment, BasicQuestionResponse} from "../queries/question";
|
|
|
|
export const EDIT_QUESTION = gql`
|
|
mutation UpdateQuestion($id: ID!, $title: String, $description: String, $categoryRowId: Int) {
|
|
updateQuestion(input: {id: $id, questionPatch: {categoryRowId: $categoryRowId, description: $description, title: $title}}) {
|
|
question {
|
|
...BasicQuestionFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicQuestionFragment}
|
|
`
|
|
|
|
export interface EditQuestionResponse {
|
|
updateQuestion?: {
|
|
question: BasicQuestionResponse,
|
|
__typename: "UpdateQuestionPayload",
|
|
},
|
|
}
|
|
|
|
export interface EditQuestionVariables {
|
|
id: string,
|
|
title?: string,
|
|
description?: string | null,
|
|
categoryRowId?: number | null,
|
|
}
|
|
|
|
export const ADD_QUESTION = gql`
|
|
mutation AddQuestion($title: String!, $description: String, $categoryRowId: Int) {
|
|
createQuestion(input: {question: {title: $title, categoryRowId: $categoryRowId, description: $description}}) {
|
|
question {
|
|
...BasicQuestionFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicQuestionFragment}
|
|
`
|
|
|
|
export interface AddQuestionResponse {
|
|
createQuestion?: {
|
|
question: BasicQuestionResponse,
|
|
__typename: "CreateQuestionPayload",
|
|
}
|
|
}
|
|
|
|
export interface AddQuestionVariables {
|
|
title: string,
|
|
description?: string | null,
|
|
categoryRowId?: number | null
|
|
}
|
|
|
|
export const DELETE_QUESTION = gql`
|
|
mutation DeleteQuestion($id: ID!) {
|
|
deleteQuestion(input: { id: $id }) {
|
|
question {
|
|
...BasicQuestionFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicQuestionFragment}
|
|
`
|
|
|
|
export interface DeleteQuestionResponse {
|
|
deleteQuestion?: {
|
|
question: BasicQuestionResponse
|
|
__typename: "DeleteQuestionPayload",
|
|
}
|
|
}
|
|
|
|
export interface DeleteQuestionVariables {
|
|
id: string,
|
|
}
|
|
|
|
|