Reduce requested chapter data in queries

This commit is contained in:
schroda
2024-07-02 16:20:28 +02:00
parent 9b8ace003d
commit 2fa1de578c
19 changed files with 400 additions and 181 deletions

View File

@@ -0,0 +1,84 @@
/*
* 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';
const MANGA_BASE_FIELDS = gql`
fragment MANGA_BASE_FIELDS on MangaType {
id
title
thumbnailUrl
thumbnailUrlLastFetched
inLibrary
initialized
}
`;
export const CHAPTER_BASE_FIELDS = gql`
fragment CHAPTER_BASE_FIELDS on ChapterType {
id
name
mangaId
scanlator
realUrl
sourceOrder
chapterNumber
}
`;
export const CHAPTER_STATE_FIELDS = gql`
fragment CHAPTER_STATE_FIELDS on ChapterType {
id
isRead
isDownloaded
isBookmarked
}
`;
export const CHAPTER_READER_FIELDS = gql`
${CHAPTER_BASE_FIELDS}
${CHAPTER_STATE_FIELDS}
fragment CHAPTER_READER_FIELDS on ChapterType {
...CHAPTER_BASE_FIELDS
...CHAPTER_STATE_FIELDS
lastPageRead
pageCount
}
`;
export const CHAPTER_LIST_FIELDS = gql`
${CHAPTER_BASE_FIELDS}
${CHAPTER_STATE_FIELDS}
fragment CHAPTER_LIST_FIELDS on ChapterType {
...CHAPTER_BASE_FIELDS
...CHAPTER_STATE_FIELDS
fetchedAt
uploadDate
}
`;
export const CHAPTER_UPDATE_LIST_FIELDS = gql`
${CHAPTER_LIST_FIELDS}
${MANGA_BASE_FIELDS}
fragment CHAPTER_UPDATE_LIST_FIELDS on ChapterType {
...CHAPTER_LIST_FIELDS
manga {
...MANGA_BASE_FIELDS
}
}
`;