Files
suwayomi-material-you-webui/src/lib/graphql/manga/MangaFragments.ts

192 lines
3.6 KiB
TypeScript
Raw Normal View History

2024-07-08 18:02:50 +02:00
/*
* 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';
2025-12-22 14:00:44 +01:00
import { SOURCE_BASE_FIELDS } from '@/lib/graphql/source/SourceFragments.ts';
2024-07-08 18:02:50 +02:00
export const MANGA_META_FIELDS = gql`
fragment MANGA_META_FIELDS on MangaMetaType {
mangaId
key
value
}
`;
2024-07-08 18:02:50 +02:00
export const MANGA_BASE_FIELDS = gql`
fragment MANGA_BASE_FIELDS on MangaType {
id
title
thumbnailUrl
thumbnailUrlLastFetched
inLibrary
initialized
sourceId
}
`;
export const MANGA_CHAPTER_STAT_FIELDS = gql`
fragment MANGA_CHAPTER_STAT_FIELDS on MangaType {
id
unreadCount
downloadCount
bookmarkCount
hasDuplicateChapters
2024-07-08 18:02:50 +02:00
chapters {
totalCount
}
}
`;
export const MANGA_CHAPTER_NODE_FIELDS = gql`
fragment MANGA_CHAPTER_NODE_FIELDS on MangaType {
firstUnreadChapter {
id
sourceOrder
isRead
mangaId
chapterNumber
name
scanlator
}
lastReadChapter {
id
sourceOrder
lastReadAt
}
latestReadChapter {
id
sourceOrder
lastReadAt
}
latestFetchedChapter {
id
fetchedAt
}
latestUploadedChapter {
id
uploadDate
}
}
`;
2024-07-08 18:02:50 +02:00
export const MANGA_READER_FIELDS = gql`
${MANGA_BASE_FIELDS}
${MANGA_META_FIELDS}
${SOURCE_BASE_FIELDS}
2024-07-08 18:02:50 +02:00
fragment MANGA_READER_FIELDS on MangaType {
...MANGA_BASE_FIELDS
genre
source {
...SOURCE_BASE_FIELDS
}
2024-07-08 18:02:50 +02:00
meta {
...MANGA_META_FIELDS
2024-07-08 18:02:50 +02:00
}
chapters {
totalCount
}
trackRecords {
totalCount
}
}
`;
export const MANGA_LIBRARY_FIELDS = gql`
${MANGA_BASE_FIELDS}
${MANGA_CHAPTER_STAT_FIELDS}
${MANGA_CHAPTER_NODE_FIELDS}
${MANGA_META_FIELDS}
2024-07-08 18:02:50 +02:00
fragment MANGA_LIBRARY_FIELDS on MangaType {
...MANGA_BASE_FIELDS
...MANGA_CHAPTER_STAT_FIELDS
...MANGA_CHAPTER_NODE_FIELDS
2024-07-08 18:02:50 +02:00
genre
lastFetchedAt
inLibraryAt
2024-09-15 00:48:32 +02:00
status
2024-07-08 18:02:50 +02:00
artist
author
description
meta {
...MANGA_META_FIELDS
}
source {
id
displayName
}
2024-07-08 18:02:50 +02:00
trackRecords {
totalCount
nodes {
id
trackerId
}
}
}
`;
export const MANGA_SCREEN_FIELDS = gql`
${MANGA_LIBRARY_FIELDS}
2025-04-20 21:40:28 +02:00
${MANGA_META_FIELDS}
2024-07-08 18:02:50 +02:00
fragment MANGA_SCREEN_FIELDS on MangaType {
...MANGA_LIBRARY_FIELDS
artist
author
description
status
realUrl
2025-04-20 21:40:28 +02:00
meta {
...MANGA_META_FIELDS
}
2024-07-08 18:02:50 +02:00
sourceId
source {
id
displayName
}
trackRecords {
totalCount
nodes {
id
trackerId
}
}
}
`;
export const MANGA_LIBRARY_DUPLICATE_SCREEN_FIELDS = gql`
${MANGA_BASE_FIELDS}
${MANGA_CHAPTER_STAT_FIELDS}
fragment MANGA_LIBRARY_DUPLICATE_SCREEN_FIELDS on MangaType {
...MANGA_BASE_FIELDS
...MANGA_CHAPTER_STAT_FIELDS
description
}
`;