109 lines
2.1 KiB
TypeScript
109 lines
2.1 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: EditQuestionPayload | null;
|
|
}
|
|
|
|
export interface EditQuestionPayload {
|
|
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: AddQuestionPayload | null;
|
|
}
|
|
|
|
export interface AddQuestionPayload {
|
|
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: DeleteQuestionPayload | null;
|
|
}
|
|
|
|
export interface DeleteQuestionPayload {
|
|
question: BasicQuestionResponse;
|
|
__typename: "DeleteQuestionPayload";
|
|
}
|
|
|
|
export interface DeleteQuestionVariables {
|
|
id: string;
|
|
}
|