Update graphql files structure

This commit is contained in:
schroda
2025-12-22 14:00:44 +01:00
parent 14a881f17f
commit 083586c567
71 changed files with 544 additions and 550 deletions

View File

@@ -0,0 +1,95 @@
/*
* 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';
import { MANGA_CHAPTER_NODE_FIELDS, MANGA_CHAPTER_STAT_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts';
const UPDATER_MANGA_FIELDS = gql`
${MANGA_CHAPTER_STAT_FIELDS}
${MANGA_CHAPTER_NODE_FIELDS}
fragment UPDATER_MANGA_FIELDS on MangaUpdateType {
status
manga {
id
title
thumbnailUrl
...MANGA_CHAPTER_STAT_FIELDS
...MANGA_CHAPTER_NODE_FIELDS
}
}
`;
const UPDATER_CATEGORY_FIELDS = gql`
fragment UPDATER_CATEGORY_FIELDS on CategoryUpdateType {
status
category {
id
name
}
}
`;
const UPDATER_JOB_INFO_FIELDS = gql`
fragment UPDATER_JOB_INFO_FIELDS on UpdaterJobsInfoType {
isRunning
totalJobs
finishedJobs
skippedCategoriesCount
skippedMangasCount
}
`;
export const UPDATER_STATUS_FIELDS = gql`
${UPDATER_JOB_INFO_FIELDS}
${UPDATER_CATEGORY_FIELDS}
${UPDATER_MANGA_FIELDS}
fragment UPDATER_STATUS_FIELDS on LibraryUpdateStatus {
jobsInfo {
...UPDATER_JOB_INFO_FIELDS
}
categoryUpdates {
...UPDATER_CATEGORY_FIELDS
}
mangaUpdates {
...UPDATER_MANGA_FIELDS
}
}
`;
export const UPDATER_SUBSCRIPTION_FIELDS = gql`
${UPDATER_JOB_INFO_FIELDS}
${UPDATER_CATEGORY_FIELDS}
${UPDATER_MANGA_FIELDS}
fragment UPDATER_SUBSCRIPTION_FIELDS on UpdaterUpdates {
omittedUpdates
jobsInfo {
...UPDATER_JOB_INFO_FIELDS
}
categoryUpdates {
...UPDATER_CATEGORY_FIELDS
}
mangaUpdates {
...UPDATER_MANGA_FIELDS
}
}
`;
export const UPDATER_START_STOP_FIELDS = gql`
fragment UPDATER_START_STOP_FIELDS on UpdateStatus {
isRunning
}
`;

View File

@@ -0,0 +1,30 @@
/*
* 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';
import { UPDATER_STATUS_FIELDS } from '@/lib/graphql/updater/UpdaterFragments.ts';
export const UPDATE_LIBRARY = gql`
${UPDATER_STATUS_FIELDS}
mutation UPDATE_LIBRARY($input: UpdateLibraryInput = {}) {
updateLibrary(input: $input) {
updateStatus {
...UPDATER_STATUS_FIELDS
}
}
}
`;
export const STOP_UPDATER = gql`
mutation STOP_UPDATER($input: UpdateStopInput = {}) {
updateStop(input: $input) {
clientMutationId
}
}
`;

View File

@@ -0,0 +1,28 @@
/*
* 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';
import { UPDATER_STATUS_FIELDS } from '@/lib/graphql/updater/UpdaterFragments.ts';
export const GET_UPDATE_STATUS = gql`
${UPDATER_STATUS_FIELDS}
query GET_UPDATE_STATUS {
libraryUpdateStatus {
...UPDATER_STATUS_FIELDS
}
}
`;
export const GET_LAST_UPDATE_TIMESTAMP = gql`
query GET_LAST_UPDATE_TIMESTAMP {
lastUpdateTimestamp {
timestamp
}
}
`;

View File

@@ -0,0 +1,20 @@
/*
* 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';
import { UPDATER_SUBSCRIPTION_FIELDS } from '@/lib/graphql/updater/UpdaterFragments.ts';
export const UPDATER_SUBSCRIPTION = gql`
${UPDATER_SUBSCRIPTION_FIELDS}
subscription UPDATER_SUBSCRIPTION($input: LibraryUpdateStatusChangedInput!) {
libraryUpdateStatusChanged(input: $input) {
...UPDATER_SUBSCRIPTION_FIELDS
}
}
`;