2023-08-05 01:03:40 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import gql from 'graphql-tag';
|
2025-12-22 14:00:44 +01:00
|
|
|
import { CATEGORY_META_FIELDS, CATEGORY_SETTING_FIELDS } from '@/lib/graphql/category/CategoryFragments.ts';
|
2023-08-05 01:03:40 +02:00
|
|
|
|
|
|
|
|
export const CREATE_CATEGORY = gql`
|
2024-07-01 21:40:27 +02:00
|
|
|
${CATEGORY_SETTING_FIELDS}
|
2023-08-05 01:03:40 +02:00
|
|
|
mutation CREATE_CATEGORY($input: CreateCategoryInput!) {
|
|
|
|
|
createCategory(input: $input) {
|
|
|
|
|
category {
|
2024-07-01 21:40:27 +02:00
|
|
|
...CATEGORY_SETTING_FIELDS
|
2023-08-05 01:03:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const DELETE_CATEGORY = gql`
|
|
|
|
|
mutation DELETE_CATEGORY($input: DeleteCategoryInput!) {
|
|
|
|
|
deleteCategory(input: $input) {
|
|
|
|
|
category {
|
2023-11-24 03:17:49 +01:00
|
|
|
id
|
2023-08-05 01:03:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const UPDATE_CATEGORY = gql`
|
2023-11-24 03:17:49 +01:00
|
|
|
mutation UPDATE_CATEGORY(
|
|
|
|
|
$input: UpdateCategoryInput!
|
|
|
|
|
$getDefault: Boolean!
|
|
|
|
|
$getIncludeInUpdate: Boolean!
|
2024-01-21 13:31:04 -08:00
|
|
|
$getIncludeInDownload: Boolean!
|
2023-11-24 03:17:49 +01:00
|
|
|
$getName: Boolean!
|
|
|
|
|
) {
|
2023-08-05 01:03:40 +02:00
|
|
|
updateCategory(input: $input) {
|
|
|
|
|
category {
|
2023-11-24 03:17:49 +01:00
|
|
|
id
|
|
|
|
|
default @include(if: $getDefault)
|
|
|
|
|
includeInUpdate @include(if: $getIncludeInUpdate)
|
2024-01-21 13:31:04 -08:00
|
|
|
includeInDownload @include(if: $getIncludeInDownload)
|
2023-11-24 03:17:49 +01:00
|
|
|
name @include(if: $getName)
|
2023-08-05 01:03:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const UPDATE_CATEGORIES = gql`
|
2023-11-24 03:17:49 +01:00
|
|
|
mutation UPDATE_CATEGORIES(
|
|
|
|
|
$input: UpdateCategoriesInput!
|
|
|
|
|
$getDefault: Boolean!
|
|
|
|
|
$getIncludeInUpdate: Boolean!
|
2024-01-21 13:31:04 -08:00
|
|
|
$getIncludeInDownload: Boolean!
|
2023-11-24 03:17:49 +01:00
|
|
|
$getName: Boolean!
|
|
|
|
|
) {
|
2023-08-05 01:03:40 +02:00
|
|
|
updateCategories(input: $input) {
|
|
|
|
|
categories {
|
2023-11-24 03:17:49 +01:00
|
|
|
id
|
|
|
|
|
default @include(if: $getDefault)
|
|
|
|
|
includeInUpdate @include(if: $getIncludeInUpdate)
|
2024-01-21 13:31:04 -08:00
|
|
|
includeInDownload @include(if: $getIncludeInDownload)
|
2023-11-24 03:17:49 +01:00
|
|
|
name @include(if: $getName)
|
2023-08-05 01:03:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const UPDATE_CATEGORY_ORDER = gql`
|
|
|
|
|
mutation UPDATE_CATEGORY_ORDER($input: UpdateCategoryOrderInput!) {
|
|
|
|
|
updateCategoryOrder(input: $input) {
|
|
|
|
|
categories {
|
2023-11-24 03:17:49 +01:00
|
|
|
id
|
|
|
|
|
order
|
2023-08-05 01:03:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
2026-01-25 20:32:56 +01:00
|
|
|
|
|
|
|
|
export const UPDATE_CATEGORY_METADATA = gql`
|
|
|
|
|
${CATEGORY_META_FIELDS}
|
|
|
|
|
|
|
|
|
|
mutation UPDATE_CATEGORY_METADATA(
|
|
|
|
|
$updateInput: SetCategoryMetasInput!
|
|
|
|
|
$hasUpdates: Boolean!
|
|
|
|
|
$deleteInput: DeleteCategoryMetasInput!
|
|
|
|
|
$hasDeletions: Boolean!
|
|
|
|
|
$migrateInput: SetCategoryMetasInput!
|
|
|
|
|
$isMigration: Boolean!
|
|
|
|
|
) {
|
|
|
|
|
updatedMeta: setCategoryMetas(input: $updateInput) @include(if: $hasUpdates) {
|
|
|
|
|
metas {
|
|
|
|
|
...CATEGORY_META_FIELDS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
deletedMeta: deleteCategoryMetas(input: $deleteInput) @include(if: $hasDeletions) {
|
|
|
|
|
metas {
|
|
|
|
|
...CATEGORY_META_FIELDS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
migrationMeta: setCategoryMetas(input: $migrateInput) @include(if: $isMigration) {
|
|
|
|
|
metas {
|
|
|
|
|
...CATEGORY_META_FIELDS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|