78 lines
1.7 KiB
TypeScript
78 lines
1.7 KiB
TypeScript
import {gql} from "@apollo/client";
|
|
import {BasicCategoryFragment, BasicCategoryResponse} from "../queries/category";
|
|
|
|
export const EDIT_CATEGORY = gql`
|
|
mutation UpdateCategory($id: ID!, $title: String, $description: String) {
|
|
updateCategory(input: {id: $id, categoryPatch: {description: $description, title: $title}}) {
|
|
category {
|
|
...BasicCategoryFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicCategoryFragment}
|
|
`
|
|
|
|
export interface EditCategoryResponse {
|
|
updateCategory: EditCategoryPayload | null
|
|
}
|
|
|
|
export interface EditCategoryPayload {
|
|
category: BasicCategoryResponse,
|
|
__typename: "UpdateCategoryPayload",
|
|
}
|
|
|
|
export interface EditCategoryVariables {
|
|
id: string,
|
|
title?: string,
|
|
description?: string | null,
|
|
}
|
|
|
|
export const ADD_CATEGORY = gql`
|
|
mutation AddCategory($title: String!, $description: String) {
|
|
createCategory(input: {category: {title: $title, description: $description}}) {
|
|
category {
|
|
...BasicCategoryFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicCategoryFragment}
|
|
`
|
|
|
|
export interface AddCategoryResponse {
|
|
createCategory: AddCategoryPayload | null,
|
|
}
|
|
|
|
export interface AddCategoryPayload {
|
|
category: BasicCategoryResponse,
|
|
__typename: "CreateCategoryPayload",
|
|
}
|
|
|
|
export interface AddCategoryVariables {
|
|
title: string,
|
|
description?: string | null,
|
|
}
|
|
|
|
export const DELETE_CATEGORY = gql`
|
|
mutation DeleteCategory($id: ID!) {
|
|
deleteCategory(input: { id: $id }) {
|
|
category {
|
|
...BasicCategoryFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicCategoryFragment}
|
|
`
|
|
|
|
export interface DeleteCategoryResponse {
|
|
deleteCategory: DeleteCategoryPayload | null
|
|
}
|
|
|
|
export interface DeleteCategoryPayload {
|
|
category: BasicCategoryResponse,
|
|
__typename: "DeleteCategoryPayload",
|
|
}
|
|
|
|
export interface DeleteCategoryVariables {
|
|
id: string,
|
|
}
|