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

@@ -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
}
}
`;