Update graphql files structure
This commit is contained in:
224
src/lib/graphql/source/SourceFragments.ts
Normal file
224
src/lib/graphql/source/SourceFragments.ts
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* 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';
|
||||
|
||||
export const SOURCE_META_FIELDS = gql`
|
||||
fragment SOURCE_META_FIELDS on SourceMetaType {
|
||||
sourceId
|
||||
key
|
||||
value
|
||||
}
|
||||
`;
|
||||
|
||||
export const SOURCE_BASE_FIELDS = gql`
|
||||
fragment SOURCE_BASE_FIELDS on SourceType {
|
||||
id
|
||||
name
|
||||
displayName
|
||||
lang
|
||||
}
|
||||
`;
|
||||
|
||||
export const SOURCE_MIGRATABLE_FIELDS = gql`
|
||||
${SOURCE_BASE_FIELDS}
|
||||
|
||||
fragment SOURCE_MIGRATABLE_FIELDS on SourceType {
|
||||
...SOURCE_BASE_FIELDS
|
||||
|
||||
lang
|
||||
iconUrl
|
||||
}
|
||||
`;
|
||||
|
||||
export const SOURCE_LIST_FIELDS = gql`
|
||||
${SOURCE_BASE_FIELDS}
|
||||
${SOURCE_META_FIELDS}
|
||||
|
||||
fragment SOURCE_LIST_FIELDS on SourceType {
|
||||
...SOURCE_BASE_FIELDS
|
||||
|
||||
lang
|
||||
iconUrl
|
||||
isNsfw
|
||||
isConfigurable
|
||||
supportsLatest
|
||||
|
||||
meta {
|
||||
...SOURCE_META_FIELDS
|
||||
}
|
||||
|
||||
extension {
|
||||
pkgName
|
||||
repo
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SOURCE_BROWSE_FIELDS = gql`
|
||||
${SOURCE_BASE_FIELDS}
|
||||
${SOURCE_META_FIELDS}
|
||||
|
||||
fragment SOURCE_BROWSE_FIELDS on SourceType {
|
||||
...SOURCE_BASE_FIELDS
|
||||
|
||||
baseUrl
|
||||
|
||||
isConfigurable
|
||||
supportsLatest
|
||||
|
||||
meta {
|
||||
...SOURCE_META_FIELDS
|
||||
}
|
||||
|
||||
filters {
|
||||
... on CheckBoxFilter {
|
||||
type: __typename
|
||||
CheckBoxFilterDefault: default
|
||||
name
|
||||
}
|
||||
... on HeaderFilter {
|
||||
type: __typename
|
||||
name
|
||||
}
|
||||
... on SelectFilter {
|
||||
type: __typename
|
||||
SelectFilterDefault: default
|
||||
name
|
||||
values
|
||||
}
|
||||
... on TriStateFilter {
|
||||
type: __typename
|
||||
TriStateFilterDefault: default
|
||||
name
|
||||
}
|
||||
... on TextFilter {
|
||||
type: __typename
|
||||
TextFilterDefault: default
|
||||
name
|
||||
}
|
||||
... on SortFilter {
|
||||
type: __typename
|
||||
SortFilterDefault: default {
|
||||
ascending
|
||||
index
|
||||
}
|
||||
name
|
||||
values
|
||||
}
|
||||
... on SeparatorFilter {
|
||||
type: __typename
|
||||
name
|
||||
}
|
||||
... on GroupFilter {
|
||||
type: __typename
|
||||
name
|
||||
filters {
|
||||
... on CheckBoxFilter {
|
||||
type: __typename
|
||||
CheckBoxFilterDefault: default
|
||||
name
|
||||
}
|
||||
... on HeaderFilter {
|
||||
type: __typename
|
||||
name
|
||||
}
|
||||
... on SelectFilter {
|
||||
type: __typename
|
||||
SelectFilterDefault: default
|
||||
name
|
||||
values
|
||||
}
|
||||
... on TriStateFilter {
|
||||
type: __typename
|
||||
TriStateFilterDefault: default
|
||||
name
|
||||
}
|
||||
... on TextFilter {
|
||||
type: __typename
|
||||
TextFilterDefault: default
|
||||
name
|
||||
}
|
||||
... on SortFilter {
|
||||
type: __typename
|
||||
SortFilterDefault: default {
|
||||
ascending
|
||||
index
|
||||
}
|
||||
name
|
||||
values
|
||||
}
|
||||
... on SeparatorFilter {
|
||||
type: __typename
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SOURCE_SETTING_FIELDS = gql`
|
||||
${SOURCE_BASE_FIELDS}
|
||||
|
||||
fragment SOURCE_SETTING_FIELDS on SourceType {
|
||||
...SOURCE_BASE_FIELDS
|
||||
|
||||
preferences {
|
||||
... on CheckBoxPreference {
|
||||
type: __typename
|
||||
CheckBoxCheckBoxCurrentValue: currentValue
|
||||
summary
|
||||
CheckBoxDefault: default
|
||||
key
|
||||
CheckBoxTitle: title
|
||||
}
|
||||
... on EditTextPreference {
|
||||
type: __typename
|
||||
EditTextPreferenceCurrentValue: currentValue
|
||||
EditTextPreferenceDefault: default
|
||||
EditTextPreferenceTitle: title
|
||||
text
|
||||
summary
|
||||
key
|
||||
dialogTitle
|
||||
dialogMessage
|
||||
}
|
||||
... on SwitchPreference {
|
||||
type: __typename
|
||||
SwitchPreferenceCurrentValue: currentValue
|
||||
summary
|
||||
key
|
||||
SwitchPreferenceDefault: default
|
||||
SwitchPreferenceTitle: title
|
||||
}
|
||||
... on MultiSelectListPreference {
|
||||
type: __typename
|
||||
dialogMessage
|
||||
dialogTitle
|
||||
MultiSelectListPreferenceTitle: title
|
||||
summary
|
||||
key
|
||||
entryValues
|
||||
entries
|
||||
MultiSelectListPreferenceDefault: default
|
||||
MultiSelectListPreferenceCurrentValue: currentValue
|
||||
}
|
||||
... on ListPreference {
|
||||
type: __typename
|
||||
ListPreferenceCurrentValue: currentValue
|
||||
ListPreferenceDefault: default
|
||||
ListPreferenceTitle: title
|
||||
summary
|
||||
key
|
||||
entryValues
|
||||
entries
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
60
src/lib/graphql/source/SourceMutation.ts
Normal file
60
src/lib/graphql/source/SourceMutation.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 { SOURCE_META_FIELDS, SOURCE_SETTING_FIELDS } from '@/lib/graphql/source/SourceFragments.ts';
|
||||
import { MANGA_BASE_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts';
|
||||
|
||||
export const GET_SOURCE_MANGAS_FETCH = gql`
|
||||
${MANGA_BASE_FIELDS}
|
||||
|
||||
mutation GET_SOURCE_MANGAS_FETCH($input: FetchSourceMangaInput!) {
|
||||
fetchSourceManga(input: $input) {
|
||||
hasNextPage
|
||||
mangas {
|
||||
...MANGA_BASE_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_SOURCE_PREFERENCES = gql`
|
||||
${SOURCE_SETTING_FIELDS}
|
||||
|
||||
mutation UPDATE_SOURCE_PREFERENCES($input: UpdateSourcePreferenceInput!) {
|
||||
updateSourcePreference(input: $input) {
|
||||
source {
|
||||
...SOURCE_SETTING_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SET_SOURCE_METADATA = gql`
|
||||
${SOURCE_META_FIELDS}
|
||||
|
||||
mutation SET_SOURCE_METADATA($input: SetSourceMetaInput!) {
|
||||
setSourceMeta(input: $input) {
|
||||
meta {
|
||||
...SOURCE_META_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_SOURCE_METADATA = gql`
|
||||
${SOURCE_META_FIELDS}
|
||||
|
||||
mutation DELETE_SOURCE_METADATA($input: DeleteSourceMetaInput!) {
|
||||
deleteSourceMeta(input: $input) {
|
||||
meta {
|
||||
...SOURCE_META_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
72
src/lib/graphql/source/SourceQuery.ts
Normal file
72
src/lib/graphql/source/SourceQuery.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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 {
|
||||
SOURCE_BROWSE_FIELDS,
|
||||
SOURCE_LIST_FIELDS,
|
||||
SOURCE_MIGRATABLE_FIELDS,
|
||||
SOURCE_SETTING_FIELDS,
|
||||
} from '@/lib/graphql/source/SourceFragments.ts';
|
||||
|
||||
export const GET_SOURCE_BROWSE = gql`
|
||||
${SOURCE_BROWSE_FIELDS}
|
||||
|
||||
query GET_SOURCE_BROWSE($id: LongString!) {
|
||||
source(id: $id) {
|
||||
...SOURCE_BROWSE_FIELDS
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_SOURCE_SETTINGS = gql`
|
||||
${SOURCE_SETTING_FIELDS}
|
||||
|
||||
query GET_SOURCE_SETTINGS($id: LongString!) {
|
||||
source(id: $id) {
|
||||
...SOURCE_SETTING_FIELDS
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_SOURCE_MIGRATABLE = gql`
|
||||
${SOURCE_MIGRATABLE_FIELDS}
|
||||
|
||||
query GET_SOURCE_MIGRATABLE($id: LongString!) {
|
||||
source(id: $id) {
|
||||
...SOURCE_MIGRATABLE_FIELDS
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_SOURCES_LIST = gql`
|
||||
${SOURCE_LIST_FIELDS}
|
||||
|
||||
query GET_SOURCES_LIST {
|
||||
sources {
|
||||
nodes {
|
||||
...SOURCE_LIST_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_MIGRATABLE_SOURCES = gql`
|
||||
${SOURCE_MIGRATABLE_FIELDS}
|
||||
|
||||
query GET_MIGRATABLE_SOURCES {
|
||||
mangas(condition: { inLibrary: true }) {
|
||||
nodes {
|
||||
sourceId
|
||||
source {
|
||||
...SOURCE_MIGRATABLE_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
Reference in New Issue
Block a user