Feature/gql improve queries mutations subscriptions (#470)

* [Codegen] Request less fields for category mutations

* [Codegen] Request less fields for chapter mutations

* [Codegen] Request less fields for downloader mutations

* [Codegen] Request less fields for extension mutations

* [Codegen] Request less fields for manga mutations

* [Codegen] Request less fields for source mutations

* [Codegen] Request less fields for updater subscription

* [Codegen] Request less fields for downloader subscription

* [Codegen] Combine chapter update mutations
This commit is contained in:
schroda
2023-11-24 03:17:49 +01:00
committed by GitHub
parent 3b147b1b46
commit 7adc28a35c
12 changed files with 443 additions and 198 deletions

View File

@@ -22,38 +22,35 @@ export const CREATE_CATEGORY = gql`
`;
export const DELETE_CATEGORY = gql`
${FULL_CATEGORY_FIELDS}
mutation DELETE_CATEGORY($input: DeleteCategoryInput!) {
deleteCategory(input: $input) {
clientMutationId
category {
...FULL_CATEGORY_FIELDS
id
}
}
}
`;
export const DELETE_CATEGORY_METADATA = gql`
${FULL_CATEGORY_FIELDS}
mutation DELETE_CATEGORY_METADATA($input: DeleteCategoryMetaInput!) {
deleteCategoryMeta(input: $input) {
clientMutationId
meta {
key
value
category {
...FULL_CATEGORY_FIELDS
}
}
category {
...FULL_CATEGORY_FIELDS
id
meta {
key
value
}
}
}
}
`;
export const SET_CATEGORY_METADATA = gql`
${FULL_CATEGORY_FIELDS}
mutation SET_CATEGORY_METADATA($input: SetCategoryMetaInput!) {
setCategoryMeta(input: $input) {
clientMutationId
@@ -61,7 +58,11 @@ export const SET_CATEGORY_METADATA = gql`
key
value
category {
...FULL_CATEGORY_FIELDS
id
meta {
key
value
}
}
}
}
@@ -69,36 +70,50 @@ export const SET_CATEGORY_METADATA = gql`
`;
export const UPDATE_CATEGORY = gql`
${FULL_CATEGORY_FIELDS}
mutation UPDATE_CATEGORY($input: UpdateCategoryInput!) {
mutation UPDATE_CATEGORY(
$input: UpdateCategoryInput!
$getDefault: Boolean!
$getIncludeInUpdate: Boolean!
$getName: Boolean!
) {
updateCategory(input: $input) {
clientMutationId
category {
...FULL_CATEGORY_FIELDS
id
default @include(if: $getDefault)
includeInUpdate @include(if: $getIncludeInUpdate)
name @include(if: $getName)
}
}
}
`;
export const UPDATE_CATEGORIES = gql`
${FULL_CATEGORY_FIELDS}
mutation UPDATE_CATEGORIES($input: UpdateCategoriesInput!) {
mutation UPDATE_CATEGORIES(
$input: UpdateCategoriesInput!
$getDefault: Boolean!
$getIncludeInUpdate: Boolean!
$getName: Boolean!
) {
updateCategories(input: $input) {
clientMutationId
categories {
...FULL_CATEGORY_FIELDS
id
default @include(if: $getDefault)
includeInUpdate @include(if: $getIncludeInUpdate)
name @include(if: $getName)
}
}
}
`;
export const UPDATE_CATEGORY_ORDER = gql`
${FULL_CATEGORY_FIELDS}
mutation UPDATE_CATEGORY_ORDER($input: UpdateCategoryOrderInput!) {
updateCategoryOrder(input: $input) {
clientMutationId
categories {
...FULL_CATEGORY_FIELDS
id
order
}
}
}

View File

@@ -10,7 +10,6 @@ import gql from 'graphql-tag';
import { FULL_CHAPTER_FIELDS } from '@/lib/graphql/Fragments';
export const DELETE_CHAPTER_METADATA = gql`
${FULL_CHAPTER_FIELDS}
mutation DELETE_CHAPTER_METADATA($input: DeleteChapterMetaInput!) {
deleteChapterMeta(input: $input) {
clientMutationId
@@ -18,11 +17,19 @@ export const DELETE_CHAPTER_METADATA = gql`
key
value
chapter {
...FULL_CHAPTER_FIELDS
id
meta {
key
value
}
}
}
chapter {
...FULL_CHAPTER_FIELDS
id
meta {
key
value
}
}
}
}
@@ -30,12 +37,12 @@ export const DELETE_CHAPTER_METADATA = gql`
// makes the server fetch and return the pages of a chapter
export const GET_CHAPTER_PAGES_FETCH = gql`
${FULL_CHAPTER_FIELDS}
mutation GET_CHAPTER_PAGES_FETCH($input: FetchChapterPagesInput!) {
fetchChapterPages(input: $input) {
clientMutationId
chapter {
...FULL_CHAPTER_FIELDS
id
pageCount
}
pages
}
@@ -56,7 +63,6 @@ export const GET_MANGA_CHAPTERS_FETCH = gql`
`;
export const SET_CHAPTER_METADATA = gql`
${FULL_CHAPTER_FIELDS}
mutation SET_CHAPTER_METADATA($input: SetChapterMetaInput!) {
setChapterMeta(input: $input) {
clientMutationId
@@ -64,7 +70,11 @@ export const SET_CHAPTER_METADATA = gql`
key
value
chapter {
...FULL_CHAPTER_FIELDS
id
meta {
key
value
}
}
}
}
@@ -72,25 +82,93 @@ export const SET_CHAPTER_METADATA = gql`
`;
export const UPDATE_CHAPTER = gql`
${FULL_CHAPTER_FIELDS}
mutation UPDATE_CHAPTER($input: UpdateChapterInput!) {
mutation UPDATE_CHAPTER(
$input: UpdateChapterInput!
$getBookmarked: Boolean!
$getRead: Boolean!
$getLastPageRead: Boolean!
$id: Int!
$deleteChapter: Boolean!
$mangaId: Int!
$downloadAhead: Boolean!
) {
updateChapter(input: $input) {
clientMutationId
chapter {
...FULL_CHAPTER_FIELDS
id
isBookmarked @include(if: $getBookmarked)
isRead @include(if: $getRead)
lastReadAt @include(if: $getRead)
lastPageRead @include(if: $getLastPageRead)
manga @include(if: $getRead) {
id
unreadCount
lastReadChapter {
id
}
}
}
}
deleteDownloadedChapter(input: { id: $id }) @include(if: $deleteChapter) {
clientMutationId
chapters {
id
isDownloaded
manga {
id
downloadCount
}
}
}
downloadAhead(input: { mangaIds: [$mangaId], latestReadChapterIds: [$id] }) @include(if: $downloadAhead) {
clientMutationId
}
}
`;
export const UPDATE_CHAPTERS = gql`
${FULL_CHAPTER_FIELDS}
mutation UPDATE_CHAPTERS($input: UpdateChaptersInput!) {
mutation UPDATE_CHAPTERS(
$input: UpdateChaptersInput!
$getBookmarked: Boolean!
$getRead: Boolean!
$getLastPageRead: Boolean!
$chapterIdsToDelete: [Int!]!
$deleteChapters: Boolean!
$mangaIds: [Int!]!
$lastReadChapterIds: [Int!]!
$downloadAhead: Boolean!
) {
updateChapters(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
id
isBookmarked @include(if: $getBookmarked)
isRead @include(if: $getRead)
lastReadAt @include(if: $getRead)
lastPageRead @include(if: $getLastPageRead)
manga @include(if: $getRead) {
id
unreadCount
lastReadChapter {
id
}
}
}
}
deleteDownloadedChapters(input: { ids: $chapterIdsToDelete }) @include(if: $deleteChapters) {
clientMutationId
chapters {
id
isDownloaded
manga {
id
downloadCount
}
}
}
downloadAhead(input: { mangaIds: $mangaIds, latestReadChapterIds: $lastReadChapterIds })
@include(if: $downloadAhead) {
clientMutationId
}
}
`;

View File

@@ -7,7 +7,7 @@
*/
import gql from 'graphql-tag';
import { FULL_CHAPTER_FIELDS, FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments';
import { FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments';
export const CLEAR_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS}
@@ -22,24 +22,24 @@ export const CLEAR_DOWNLOADER = gql`
`;
export const DELETE_DOWNLOADED_CHAPTER = gql`
${FULL_CHAPTER_FIELDS}
mutation DELETE_DOWNLOADED_CHAPTER($input: DeleteDownloadedChapterInput!) {
deleteDownloadedChapter(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
id
isDownloaded
}
}
}
`;
export const DELETE_DOWNLOADED_CHAPTERS = gql`
${FULL_CHAPTER_FIELDS}
mutation DELETE_DOWNLOADED_CHAPTERS($input: DeleteDownloadedChaptersInput!) {
deleteDownloadedChapters(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
id
isDownloaded
}
}
}
@@ -106,24 +106,22 @@ export const REORDER_CHAPTER_DOWNLOAD = gql`
`;
export const START_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS}
mutation START_DOWNLOADER($input: StartDownloaderInput = {}) {
startDownloader(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
state
}
}
}
`;
export const STOP_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS}
mutation STOP_DOWNLOADER($input: StopDownloaderInput = {}) {
stopDownloader(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
state
}
}
}

View File

@@ -23,24 +23,32 @@ export const GET_EXTENSIONS_FETCH = gql`
`;
export const UPDATE_EXTENSION = gql`
${FULL_EXTENSION_FIELDS}
mutation UPDATE_EXTENSION($input: UpdateExtensionInput!) {
updateExtension(input: $input) {
clientMutationId
extension {
...FULL_EXTENSION_FIELDS
apkName
versionName
versionCode
isInstalled
isObsolete
hasUpdate
}
}
}
`;
export const UPDATE_EXTENSIONS = gql`
${FULL_EXTENSION_FIELDS}
mutation UPDATE_EXTENSIONS($input: UpdateExtensionsInput!) {
updateExtensions(input: $input) {
clientMutationId
extensions {
...FULL_EXTENSION_FIELDS
apkName
versionName
versionCode
isInstalled
isObsolete
hasUpdate
}
}
}
@@ -50,10 +58,10 @@ export const INSTALL_EXTERNAL_EXTENSION = gql`
${FULL_EXTENSION_FIELDS}
mutation INSTALL_EXTERNAL_EXTENSION($file: Upload!) {
installExternalExtension(input: { extensionFile: $file }) {
clientMutationId
extension {
...FULL_EXTENSION_FIELDS
}
clientMutationId
}
}
`;

View File

@@ -10,7 +10,6 @@ import gql from 'graphql-tag';
import { FULL_MANGA_FIELDS } from '@/lib/graphql/Fragments';
export const DELETE_MANGA_METADATA = gql`
${FULL_MANGA_FIELDS}
mutation DELETE_MANGA_METADATA($input: DeleteMangaMetaInput!) {
deleteMangaMeta(input: $input) {
clientMutationId
@@ -18,11 +17,19 @@ export const DELETE_MANGA_METADATA = gql`
key
value
manga {
...FULL_MANGA_FIELDS
id
meta {
key
value
}
}
}
manga {
...FULL_MANGA_FIELDS
id
meta {
key
value
}
}
}
}
@@ -42,7 +49,6 @@ export const GET_MANGA_FETCH = gql`
`;
export const SET_MANGA_METADATA = gql`
${FULL_MANGA_FIELDS}
mutation SET_MANGA_METADATA($input: SetMangaMetaInput!) {
setMangaMeta(input: $input) {
clientMutationId
@@ -50,7 +56,11 @@ export const SET_MANGA_METADATA = gql`
key
value
manga {
...FULL_MANGA_FIELDS
id
meta {
key
value
}
}
}
}
@@ -58,48 +68,64 @@ export const SET_MANGA_METADATA = gql`
`;
export const UPDATE_MANGA = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGA($input: UpdateMangaInput!) {
updateManga(input: $input) {
clientMutationId
manga {
...FULL_MANGA_FIELDS
}
}
}
`;
export const UPDATE_MANGA_CATEGORIES = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGA_CATEGORIES($input: UpdateMangaCategoriesInput!) {
updateMangaCategories(input: $input) {
clientMutationId
manga {
...FULL_MANGA_FIELDS
id
inLibrary
inLibraryAt
}
}
}
`;
export const UPDATE_MANGAS = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGAS($input: UpdateMangasInput!) {
updateMangas(input: $input) {
clientMutationId
mangas {
...FULL_MANGA_FIELDS
id
inLibrary
inLibraryAt
}
}
}
`;
export const UPDATE_MANGA_CATEGORIES = gql`
mutation UPDATE_MANGA_CATEGORIES($input: UpdateMangaCategoriesInput!) {
updateMangaCategories(input: $input) {
clientMutationId
manga {
id
categories {
nodes {
id
mangas {
totalCount
}
}
}
}
}
}
`;
export const UPDATE_MANGAS_CATEGORIES = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGAS_CATEGORIES($input: UpdateMangasCategoriesInput!) {
updateMangasCategories(input: $input) {
clientMutationId
mangas {
...FULL_MANGA_FIELDS
id
categories {
nodes {
id
mangas {
totalCount
}
}
}
}
}
}

View File

@@ -7,7 +7,7 @@
*/
import gql from 'graphql-tag';
import { BASE_MANGA_FIELDS, FULL_SOURCE_FIELDS } from '@/lib/graphql/Fragments';
import { BASE_MANGA_FIELDS } from '@/lib/graphql/Fragments';
export const GET_SOURCE_MANGAS_FETCH = gql`
${BASE_MANGA_FIELDS}
@@ -23,12 +23,62 @@ export const GET_SOURCE_MANGAS_FETCH = gql`
`;
export const UPDATE_SOURCE_PREFERENCES = gql`
${FULL_SOURCE_FIELDS}
mutation UPDATE_SOURCE_PREFERENCES($input: UpdateSourcePreferenceInput!) {
updateSourcePreference(input: $input) {
clientMutationId
source {
...FULL_SOURCE_FIELDS
id
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
}
}
}
}
}