Use new "fetchMangaAndChapters" mutation
This commit is contained in:
@@ -159,8 +159,8 @@ export class MangaMigration {
|
|||||||
|
|
||||||
await MangaMigration.migrate(
|
await MangaMigration.migrate(
|
||||||
mangaToMigrateData?.manga,
|
mangaToMigrateData?.manga,
|
||||||
mangaToMigrateToData?.fetchManga?.manga,
|
mangaToMigrateToData?.fetchMangaAndChapters?.manga,
|
||||||
mangaToMigrateToData?.fetchChapters?.chapters,
|
mangaToMigrateToData?.fetchMangaAndChapters?.chapters,
|
||||||
options,
|
options,
|
||||||
removeMangaFromCategories,
|
removeMangaFromCategories,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export type TMigratableSource = NonNullable<GetMigratableSourcesQuery['mangas'][
|
|||||||
|
|
||||||
export type MangaToMigrate = NonNullable<GetMangaToMigrateQuery['manga']>;
|
export type MangaToMigrate = NonNullable<GetMangaToMigrateQuery['manga']>;
|
||||||
|
|
||||||
export type MangaToMigrateTo = NonNullable<GetMangaToMigrateToFetchMutation['fetchManga']>['manga'];
|
export type MangaToMigrateTo = NonNullable<GetMangaToMigrateToFetchMutation['fetchMangaAndChapters']>['manga'];
|
||||||
|
|
||||||
export type MigrationChapter = ChapterIdInfo &
|
export type MigrationChapter = ChapterIdInfo &
|
||||||
ChapterReadInfo &
|
ChapterReadInfo &
|
||||||
|
|||||||
@@ -861,10 +861,10 @@ export class MigrationManager {
|
|||||||
}).response,
|
}).response,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (updatedMatch.data?.fetchManga?.manga) {
|
if (updatedMatch.data?.fetchMangaAndChapters?.manga) {
|
||||||
return {
|
return {
|
||||||
manga: updatedMatch.data.fetchManga.manga,
|
manga: updatedMatch.data.fetchMangaAndChapters.manga,
|
||||||
chapters: updatedMatch.data.fetchChapters?.chapters ?? null,
|
chapters: updatedMatch.data.fetchMangaAndChapters?.chapters ?? null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -7,9 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import gql from 'graphql-tag';
|
import gql from 'graphql-tag';
|
||||||
import { CHAPTER_LIST_FIELDS, CHAPTER_META_FIELDS } from '@/lib/graphql/chapter/ChapterFragments.ts';
|
import { CHAPTER_META_FIELDS } from '@/lib/graphql/chapter/ChapterFragments.ts';
|
||||||
import { TRACK_RECORD_BIND_FIELDS } from '@/lib/graphql/tracker/TrackRecordFragments.ts';
|
import { TRACK_RECORD_BIND_FIELDS } from '@/lib/graphql/tracker/TrackRecordFragments.ts';
|
||||||
import { MANGA_CHAPTER_NODE_FIELDS, MANGA_CHAPTER_STAT_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts';
|
|
||||||
|
|
||||||
// makes the server fetch and return the pages of a chapter
|
// makes the server fetch and return the pages of a chapter
|
||||||
export const GET_CHAPTER_PAGES_FETCH = gql`
|
export const GET_CHAPTER_PAGES_FETCH = gql`
|
||||||
@@ -29,26 +28,6 @@ export const GET_CHAPTER_PAGES_FETCH = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// makes the server fetch and return the chapters of the manga
|
|
||||||
export const GET_MANGA_CHAPTERS_FETCH = gql`
|
|
||||||
${CHAPTER_LIST_FIELDS}
|
|
||||||
${MANGA_CHAPTER_STAT_FIELDS}
|
|
||||||
${MANGA_CHAPTER_NODE_FIELDS}
|
|
||||||
|
|
||||||
mutation GET_MANGA_CHAPTERS_FETCH($input: FetchChaptersInput!) {
|
|
||||||
fetchChapters(input: $input) {
|
|
||||||
chapters {
|
|
||||||
...CHAPTER_LIST_FIELDS
|
|
||||||
manga {
|
|
||||||
id
|
|
||||||
...MANGA_CHAPTER_STAT_FIELDS
|
|
||||||
...MANGA_CHAPTER_NODE_FIELDS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const UPDATE_CHAPTER = gql`
|
export const UPDATE_CHAPTER = gql`
|
||||||
${TRACK_RECORD_BIND_FIELDS}
|
${TRACK_RECORD_BIND_FIELDS}
|
||||||
|
|
||||||
|
|||||||
@@ -570,6 +570,17 @@ export type FetchExtensionsPayloadFieldPolicy = {
|
|||||||
clientMutationId?: FieldPolicy<any> | FieldReadFunction<any>;
|
clientMutationId?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
extensions?: FieldPolicy<any> | FieldReadFunction<any>;
|
extensions?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
};
|
};
|
||||||
|
export type FetchMangaAndChaptersPayloadKeySpecifier = (
|
||||||
|
| 'chapters'
|
||||||
|
| 'clientMutationId'
|
||||||
|
| 'manga'
|
||||||
|
| FetchMangaAndChaptersPayloadKeySpecifier
|
||||||
|
)[];
|
||||||
|
export type FetchMangaAndChaptersPayloadFieldPolicy = {
|
||||||
|
chapters?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
|
clientMutationId?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
|
manga?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
|
};
|
||||||
export type FetchMangaPayloadKeySpecifier = ('clientMutationId' | 'manga' | FetchMangaPayloadKeySpecifier)[];
|
export type FetchMangaPayloadKeySpecifier = ('clientMutationId' | 'manga' | FetchMangaPayloadKeySpecifier)[];
|
||||||
export type FetchMangaPayloadFieldPolicy = {
|
export type FetchMangaPayloadFieldPolicy = {
|
||||||
clientMutationId?: FieldPolicy<any> | FieldReadFunction<any>;
|
clientMutationId?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
@@ -905,6 +916,7 @@ export type MutationKeySpecifier = (
|
|||||||
| 'fetchChapters'
|
| 'fetchChapters'
|
||||||
| 'fetchExtensions'
|
| 'fetchExtensions'
|
||||||
| 'fetchManga'
|
| 'fetchManga'
|
||||||
|
| 'fetchMangaAndChapters'
|
||||||
| 'fetchSourceManga'
|
| 'fetchSourceManga'
|
||||||
| 'fetchTrack'
|
| 'fetchTrack'
|
||||||
| 'installExternalExtension'
|
| 'installExternalExtension'
|
||||||
@@ -985,6 +997,7 @@ export type MutationFieldPolicy = {
|
|||||||
fetchChapters?: FieldPolicy<any> | FieldReadFunction<any>;
|
fetchChapters?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
fetchExtensions?: FieldPolicy<any> | FieldReadFunction<any>;
|
fetchExtensions?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
fetchManga?: FieldPolicy<any> | FieldReadFunction<any>;
|
fetchManga?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
|
fetchMangaAndChapters?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
fetchSourceManga?: FieldPolicy<any> | FieldReadFunction<any>;
|
fetchSourceManga?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
fetchTrack?: FieldPolicy<any> | FieldReadFunction<any>;
|
fetchTrack?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
installExternalExtension?: FieldPolicy<any> | FieldReadFunction<any>;
|
installExternalExtension?: FieldPolicy<any> | FieldReadFunction<any>;
|
||||||
@@ -2712,6 +2725,13 @@ export type StrictTypedTypePolicies = {
|
|||||||
keyFields?: false | FetchExtensionsPayloadKeySpecifier | (() => undefined | FetchExtensionsPayloadKeySpecifier);
|
keyFields?: false | FetchExtensionsPayloadKeySpecifier | (() => undefined | FetchExtensionsPayloadKeySpecifier);
|
||||||
fields?: FetchExtensionsPayloadFieldPolicy;
|
fields?: FetchExtensionsPayloadFieldPolicy;
|
||||||
};
|
};
|
||||||
|
FetchMangaAndChaptersPayload?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
|
||||||
|
keyFields?:
|
||||||
|
| false
|
||||||
|
| FetchMangaAndChaptersPayloadKeySpecifier
|
||||||
|
| (() => undefined | FetchMangaAndChaptersPayloadKeySpecifier);
|
||||||
|
fields?: FetchMangaAndChaptersPayloadFieldPolicy;
|
||||||
|
};
|
||||||
FetchMangaPayload?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
|
FetchMangaPayload?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
|
||||||
keyFields?: false | FetchMangaPayloadKeySpecifier | (() => undefined | FetchMangaPayloadKeySpecifier);
|
keyFields?: false | FetchMangaPayloadKeySpecifier | (() => undefined | FetchMangaPayloadKeySpecifier);
|
||||||
fields?: FetchMangaPayloadFieldPolicy;
|
fields?: FetchMangaPayloadFieldPolicy;
|
||||||
|
|||||||
@@ -828,6 +828,20 @@ export type FetchExtensionsPayload = {
|
|||||||
extensions: Array<ExtensionType>;
|
extensions: Array<ExtensionType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type FetchMangaAndChaptersInput = {
|
||||||
|
clientMutationId?: InputMaybe<Scalars['String']['input']>;
|
||||||
|
fetchChapters: Scalars['Boolean']['input'];
|
||||||
|
fetchManga: Scalars['Boolean']['input'];
|
||||||
|
id: Scalars['Int']['input'];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type FetchMangaAndChaptersPayload = {
|
||||||
|
__typename?: 'FetchMangaAndChaptersPayload';
|
||||||
|
chapters: Array<ChapterType>;
|
||||||
|
clientMutationId?: Maybe<Scalars['String']['output']>;
|
||||||
|
manga: MangaType;
|
||||||
|
};
|
||||||
|
|
||||||
export type FetchMangaInput = {
|
export type FetchMangaInput = {
|
||||||
clientMutationId?: InputMaybe<Scalars['String']['input']>;
|
clientMutationId?: InputMaybe<Scalars['String']['input']>;
|
||||||
id: Scalars['Int']['input'];
|
id: Scalars['Int']['input'];
|
||||||
@@ -1346,9 +1360,12 @@ export type Mutation = {
|
|||||||
enqueueChapterDownload?: Maybe<EnqueueChapterDownloadPayload>;
|
enqueueChapterDownload?: Maybe<EnqueueChapterDownloadPayload>;
|
||||||
enqueueChapterDownloads?: Maybe<EnqueueChapterDownloadsPayload>;
|
enqueueChapterDownloads?: Maybe<EnqueueChapterDownloadsPayload>;
|
||||||
fetchChapterPages?: Maybe<FetchChapterPagesPayload>;
|
fetchChapterPages?: Maybe<FetchChapterPagesPayload>;
|
||||||
|
/** @deprecated Deprecated in Tachiyomix 1.6, replace with fetchMangaAndChapters */
|
||||||
fetchChapters?: Maybe<FetchChaptersPayload>;
|
fetchChapters?: Maybe<FetchChaptersPayload>;
|
||||||
fetchExtensions?: Maybe<FetchExtensionsPayload>;
|
fetchExtensions?: Maybe<FetchExtensionsPayload>;
|
||||||
|
/** @deprecated Deprecated in Tachiyomix 1.6, replace with fetchMangaAndChapters */
|
||||||
fetchManga?: Maybe<FetchMangaPayload>;
|
fetchManga?: Maybe<FetchMangaPayload>;
|
||||||
|
fetchMangaAndChapters?: Maybe<FetchMangaAndChaptersPayload>;
|
||||||
fetchSourceManga?: Maybe<FetchSourceMangaPayload>;
|
fetchSourceManga?: Maybe<FetchSourceMangaPayload>;
|
||||||
fetchTrack: FetchTrackPayload;
|
fetchTrack: FetchTrackPayload;
|
||||||
installExternalExtension?: Maybe<InstallExternalExtensionPayload>;
|
installExternalExtension?: Maybe<InstallExternalExtensionPayload>;
|
||||||
@@ -1512,6 +1529,10 @@ export type MutationFetchMangaArgs = {
|
|||||||
input: FetchMangaInput;
|
input: FetchMangaInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type MutationFetchMangaAndChaptersArgs = {
|
||||||
|
input: FetchMangaAndChaptersInput;
|
||||||
|
};
|
||||||
|
|
||||||
export type MutationFetchSourceMangaArgs = {
|
export type MutationFetchSourceMangaArgs = {
|
||||||
input: FetchSourceMangaInput;
|
input: FetchSourceMangaInput;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -529,67 +529,6 @@ export type GetChapterPagesFetchMutation = {
|
|||||||
} | null;
|
} | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GetMangaChaptersFetchMutationVariables = Exact<{
|
|
||||||
input: Types.FetchChaptersInput;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
export type GetMangaChaptersFetchMutation = {
|
|
||||||
__typename: 'Mutation';
|
|
||||||
fetchChapters: {
|
|
||||||
__typename: 'FetchChaptersPayload';
|
|
||||||
chapters: Array<{
|
|
||||||
__typename: 'ChapterType';
|
|
||||||
fetchedAt: string;
|
|
||||||
uploadDate: string;
|
|
||||||
lastReadAt: string;
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
mangaId: number;
|
|
||||||
scanlator: string | null;
|
|
||||||
realUrl: string | null;
|
|
||||||
sourceOrder: number;
|
|
||||||
chapterNumber: number;
|
|
||||||
isRead: boolean;
|
|
||||||
isDownloaded: boolean;
|
|
||||||
isBookmarked: boolean;
|
|
||||||
manga: {
|
|
||||||
__typename: 'MangaType';
|
|
||||||
id: number;
|
|
||||||
unreadCount: number;
|
|
||||||
downloadCount: number;
|
|
||||||
bookmarkCount: number;
|
|
||||||
hasDuplicateChapters: boolean;
|
|
||||||
chapters: { __typename: 'ChapterNodeList'; totalCount: number };
|
|
||||||
firstUnreadChapter: {
|
|
||||||
__typename: 'ChapterType';
|
|
||||||
id: number;
|
|
||||||
sourceOrder: number;
|
|
||||||
isRead: boolean;
|
|
||||||
mangaId: number;
|
|
||||||
chapterNumber: number;
|
|
||||||
name: string;
|
|
||||||
scanlator: string | null;
|
|
||||||
} | null;
|
|
||||||
lastReadChapter: {
|
|
||||||
__typename: 'ChapterType';
|
|
||||||
id: number;
|
|
||||||
sourceOrder: number;
|
|
||||||
lastReadAt: string;
|
|
||||||
} | null;
|
|
||||||
latestReadChapter: {
|
|
||||||
__typename: 'ChapterType';
|
|
||||||
id: number;
|
|
||||||
sourceOrder: number;
|
|
||||||
lastReadAt: string;
|
|
||||||
} | null;
|
|
||||||
latestFetchedChapter: { __typename: 'ChapterType'; id: number; fetchedAt: string } | null;
|
|
||||||
latestUploadedChapter: { __typename: 'ChapterType'; id: number; uploadDate: string } | null;
|
|
||||||
highestNumberedChapter: { __typename: 'ChapterType'; id: number; chapterNumber: number } | null;
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type UpdateChapterMutationVariables = Exact<{
|
export type UpdateChapterMutationVariables = Exact<{
|
||||||
input: Types.UpdateChapterInput;
|
input: Types.UpdateChapterInput;
|
||||||
getBookmarked: boolean;
|
getBookmarked: boolean;
|
||||||
@@ -1778,15 +1717,17 @@ export type MangaLibraryDuplicateScreenFieldsFragment = {
|
|||||||
chapters: { __typename: 'ChapterNodeList'; totalCount: number };
|
chapters: { __typename: 'ChapterNodeList'; totalCount: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GetMangaFetchMutationVariables = Exact<{
|
export type RefreshMangaMutationVariables = Exact<{
|
||||||
input: Types.FetchMangaInput;
|
id: number;
|
||||||
|
fetchManga: boolean;
|
||||||
|
fetchChapters: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type GetMangaFetchMutation = {
|
export type RefreshMangaMutation = {
|
||||||
__typename: 'Mutation';
|
__typename: 'Mutation';
|
||||||
fetchManga: {
|
fetchMangaAndChapters: {
|
||||||
__typename: 'FetchMangaPayload';
|
__typename: 'FetchMangaAndChaptersPayload';
|
||||||
manga: {
|
manga?: {
|
||||||
__typename: 'MangaType';
|
__typename: 'MangaType';
|
||||||
artist: string | null;
|
artist: string | null;
|
||||||
author: string | null;
|
author: string | null;
|
||||||
@@ -1843,18 +1784,7 @@ export type GetMangaFetchMutation = {
|
|||||||
highestNumberedChapter: { __typename: 'ChapterType'; id: number; chapterNumber: number } | null;
|
highestNumberedChapter: { __typename: 'ChapterType'; id: number; chapterNumber: number } | null;
|
||||||
chapters: { __typename: 'ChapterNodeList'; totalCount: number };
|
chapters: { __typename: 'ChapterNodeList'; totalCount: number };
|
||||||
};
|
};
|
||||||
} | null;
|
chapters?: Array<{
|
||||||
};
|
|
||||||
|
|
||||||
export type RefreshMangaMutationVariables = Exact<{
|
|
||||||
id: number;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
export type RefreshMangaMutation = {
|
|
||||||
__typename: 'Mutation';
|
|
||||||
fetchChapters: {
|
|
||||||
__typename: 'FetchChaptersPayload';
|
|
||||||
chapters: Array<{
|
|
||||||
__typename: 'ChapterType';
|
__typename: 'ChapterType';
|
||||||
fetchedAt: string;
|
fetchedAt: string;
|
||||||
uploadDate: string;
|
uploadDate: string;
|
||||||
@@ -1871,66 +1801,6 @@ export type RefreshMangaMutation = {
|
|||||||
isBookmarked: boolean;
|
isBookmarked: boolean;
|
||||||
}>;
|
}>;
|
||||||
} | null;
|
} | null;
|
||||||
fetchManga: {
|
|
||||||
__typename: 'FetchMangaPayload';
|
|
||||||
manga: {
|
|
||||||
__typename: 'MangaType';
|
|
||||||
artist: string | null;
|
|
||||||
author: string | null;
|
|
||||||
description: string | null;
|
|
||||||
status: Types.MangaStatus;
|
|
||||||
realUrl: string | null;
|
|
||||||
sourceId: string;
|
|
||||||
genre: Array<string>;
|
|
||||||
lastFetchedAt: string | null;
|
|
||||||
inLibraryAt: string;
|
|
||||||
id: number;
|
|
||||||
title: string;
|
|
||||||
thumbnailUrl: string | null;
|
|
||||||
thumbnailUrlLastFetched: string | null;
|
|
||||||
inLibrary: boolean;
|
|
||||||
initialized: boolean;
|
|
||||||
unreadCount: number;
|
|
||||||
downloadCount: number;
|
|
||||||
bookmarkCount: number;
|
|
||||||
hasDuplicateChapters: boolean;
|
|
||||||
meta: Array<{ __typename: 'MangaMetaType'; mangaId: number; key: string; value: string }>;
|
|
||||||
source: {
|
|
||||||
__typename: 'SourceType';
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
displayName: string;
|
|
||||||
lang: string;
|
|
||||||
iconUrl: string;
|
|
||||||
} | null;
|
|
||||||
trackRecords: {
|
|
||||||
__typename: 'TrackRecordNodeList';
|
|
||||||
totalCount: number;
|
|
||||||
nodes: Array<{ __typename: 'TrackRecordType'; id: number; trackerId: number }>;
|
|
||||||
};
|
|
||||||
firstUnreadChapter: {
|
|
||||||
__typename: 'ChapterType';
|
|
||||||
id: number;
|
|
||||||
sourceOrder: number;
|
|
||||||
isRead: boolean;
|
|
||||||
mangaId: number;
|
|
||||||
chapterNumber: number;
|
|
||||||
name: string;
|
|
||||||
scanlator: string | null;
|
|
||||||
} | null;
|
|
||||||
lastReadChapter: { __typename: 'ChapterType'; id: number; sourceOrder: number; lastReadAt: string } | null;
|
|
||||||
latestReadChapter: {
|
|
||||||
__typename: 'ChapterType';
|
|
||||||
id: number;
|
|
||||||
sourceOrder: number;
|
|
||||||
lastReadAt: string;
|
|
||||||
} | null;
|
|
||||||
latestFetchedChapter: { __typename: 'ChapterType'; id: number; fetchedAt: string } | null;
|
|
||||||
latestUploadedChapter: { __typename: 'ChapterType'; id: number; uploadDate: string } | null;
|
|
||||||
highestNumberedChapter: { __typename: 'ChapterType'; id: number; chapterNumber: number } | null;
|
|
||||||
chapters: { __typename: 'ChapterNodeList'; totalCount: number };
|
|
||||||
};
|
|
||||||
} | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GetMangaToMigrateToFetchMutationVariables = Exact<{
|
export type GetMangaToMigrateToFetchMutationVariables = Exact<{
|
||||||
@@ -1942,8 +1812,8 @@ export type GetMangaToMigrateToFetchMutationVariables = Exact<{
|
|||||||
|
|
||||||
export type GetMangaToMigrateToFetchMutation = {
|
export type GetMangaToMigrateToFetchMutation = {
|
||||||
__typename: 'Mutation';
|
__typename: 'Mutation';
|
||||||
fetchManga: {
|
fetchMangaAndChapters: {
|
||||||
__typename: 'FetchMangaPayload';
|
__typename: 'FetchMangaAndChaptersPayload';
|
||||||
manga: {
|
manga: {
|
||||||
__typename: 'MangaType';
|
__typename: 'MangaType';
|
||||||
id: number;
|
id: number;
|
||||||
@@ -1955,10 +1825,7 @@ export type GetMangaToMigrateToFetchMutation = {
|
|||||||
nodes: Array<{ __typename: 'TrackRecordType'; id: number; remoteId: string; trackerId: number }>;
|
nodes: Array<{ __typename: 'TrackRecordType'; id: number; remoteId: string; trackerId: number }>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} | null;
|
chapters?: Array<{
|
||||||
fetchChapters?: {
|
|
||||||
__typename: 'FetchChaptersPayload';
|
|
||||||
chapters: Array<{
|
|
||||||
__typename: 'ChapterType';
|
__typename: 'ChapterType';
|
||||||
id: number;
|
id: number;
|
||||||
chapterNumber: number;
|
chapterNumber: number;
|
||||||
|
|||||||
@@ -10,34 +10,19 @@ import gql from 'graphql-tag';
|
|||||||
import { MANGA_META_FIELDS, MANGA_SCREEN_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts';
|
import { MANGA_META_FIELDS, MANGA_SCREEN_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts';
|
||||||
import { CHAPTER_LIST_FIELDS } from '@/lib/graphql/chapter/ChapterFragments.ts';
|
import { CHAPTER_LIST_FIELDS } from '@/lib/graphql/chapter/ChapterFragments.ts';
|
||||||
|
|
||||||
// makes the server fetch and return the manga
|
|
||||||
export const GET_MANGA_FETCH = gql`
|
|
||||||
${MANGA_SCREEN_FIELDS}
|
|
||||||
|
|
||||||
mutation GET_MANGA_FETCH($input: FetchMangaInput!) {
|
|
||||||
fetchManga(input: $input) {
|
|
||||||
manga {
|
|
||||||
...MANGA_SCREEN_FIELDS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
// makes the server fetch and return the manga
|
// makes the server fetch and return the manga
|
||||||
export const REFRESH_MANGA = gql`
|
export const REFRESH_MANGA = gql`
|
||||||
${MANGA_SCREEN_FIELDS}
|
${MANGA_SCREEN_FIELDS}
|
||||||
${CHAPTER_LIST_FIELDS}
|
${CHAPTER_LIST_FIELDS}
|
||||||
|
|
||||||
mutation REFRESH_MANGA($id: Int!) {
|
mutation REFRESH_MANGA($id: Int!, $fetchManga: Boolean!, $fetchChapters: Boolean!) {
|
||||||
fetchChapters(input: { mangaId: $id }) {
|
fetchMangaAndChapters(input: { id: $id, fetchManga: $fetchManga, fetchChapters: $fetchChapters }) {
|
||||||
chapters {
|
manga @include(if: $fetchManga) {
|
||||||
...CHAPTER_LIST_FIELDS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fetchManga(input: { id: $id }) {
|
|
||||||
manga {
|
|
||||||
...MANGA_SCREEN_FIELDS
|
...MANGA_SCREEN_FIELDS
|
||||||
}
|
}
|
||||||
|
chapters @include(if: $fetchChapters) {
|
||||||
|
...CHAPTER_LIST_FIELDS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -50,7 +35,7 @@ export const GET_MANGA_TO_MIGRATE_TO_FETCH = gql`
|
|||||||
$migrateCategories: Boolean!
|
$migrateCategories: Boolean!
|
||||||
$migrateTracking: Boolean!
|
$migrateTracking: Boolean!
|
||||||
) {
|
) {
|
||||||
fetchManga(input: { id: $id }) {
|
fetchMangaAndChapters(input: { id: $id, fetchManga: true, fetchChapters: $migrateChapters }) {
|
||||||
manga {
|
manga {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
@@ -68,9 +53,7 @@ export const GET_MANGA_TO_MIGRATE_TO_FETCH = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
chapters @include(if: $migrateChapters) {
|
||||||
fetchChapters(input: { mangaId: $id }) @include(if: $migrateChapters) {
|
|
||||||
chapters {
|
|
||||||
id
|
id
|
||||||
manga {
|
manga {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ import type {
|
|||||||
GetKoSyncStatusQueryVariables,
|
GetKoSyncStatusQueryVariables,
|
||||||
GetLastUpdateTimestampQuery,
|
GetLastUpdateTimestampQuery,
|
||||||
GetLastUpdateTimestampQueryVariables,
|
GetLastUpdateTimestampQueryVariables,
|
||||||
GetMangaChaptersFetchMutation,
|
|
||||||
GetMangaChaptersFetchMutationVariables,
|
|
||||||
GetMangaFetchMutation,
|
|
||||||
GetMangaFetchMutationVariables,
|
|
||||||
GetMangasLibraryQuery,
|
GetMangasLibraryQuery,
|
||||||
GetMangasLibraryQueryVariables,
|
GetMangasLibraryQueryVariables,
|
||||||
GetMangaToMigrateQuery,
|
GetMangaToMigrateQuery,
|
||||||
@@ -240,7 +236,6 @@ import {
|
|||||||
} from '@/lib/graphql/extension/ExtensionMutation.ts';
|
} from '@/lib/graphql/extension/ExtensionMutation.ts';
|
||||||
import { GET_MIGRATABLE_SOURCES, GET_SOURCES_LIST } from '@/lib/graphql/source/SourceQuery.ts';
|
import { GET_MIGRATABLE_SOURCES, GET_SOURCES_LIST } from '@/lib/graphql/source/SourceQuery.ts';
|
||||||
import {
|
import {
|
||||||
GET_MANGA_FETCH,
|
|
||||||
GET_MANGA_TO_MIGRATE_TO_FETCH,
|
GET_MANGA_TO_MIGRATE_TO_FETCH,
|
||||||
REFRESH_MANGA,
|
REFRESH_MANGA,
|
||||||
UPDATE_MANGA,
|
UPDATE_MANGA,
|
||||||
@@ -281,7 +276,6 @@ import {
|
|||||||
} from '@/lib/graphql/chapter/ChapterQuery.ts';
|
} from '@/lib/graphql/chapter/ChapterQuery.ts';
|
||||||
import {
|
import {
|
||||||
GET_CHAPTER_PAGES_FETCH,
|
GET_CHAPTER_PAGES_FETCH,
|
||||||
GET_MANGA_CHAPTERS_FETCH,
|
|
||||||
UPDATE_CHAPTER,
|
UPDATE_CHAPTER,
|
||||||
UPDATE_CHAPTER_METADATA,
|
UPDATE_CHAPTER_METADATA,
|
||||||
UPDATE_CHAPTERS,
|
UPDATE_CHAPTERS,
|
||||||
@@ -2205,33 +2199,26 @@ export class RequestManager {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMangaFetch(
|
|
||||||
mangaId: number | string,
|
|
||||||
options?: MutationOptions<GetMangaFetchMutation, GetMangaFetchMutationVariables>,
|
|
||||||
): AbortableApolloMutationResponse<GetMangaFetchMutation> {
|
|
||||||
return this.doRequest<GetMangaFetchMutation, GetMangaFetchMutationVariables>(
|
|
||||||
GQLMethod.MUTATION,
|
|
||||||
GET_MANGA_FETCH,
|
|
||||||
{
|
|
||||||
input: {
|
|
||||||
id: Number(mangaId),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public refreshManga(
|
public refreshManga(
|
||||||
mangaId: number | string,
|
mangaId: number | string,
|
||||||
options?: MutationOptions<RefreshMangaMutation, RefreshMangaMutationVariables>,
|
{
|
||||||
|
fetchManga = true,
|
||||||
|
fetchChapters = true,
|
||||||
|
...options
|
||||||
|
}: MutationOptions<RefreshMangaMutation, RefreshMangaMutationVariables> & {
|
||||||
|
fetchManga?: boolean;
|
||||||
|
fetchChapters?: boolean;
|
||||||
|
} = {},
|
||||||
): AbortableApolloMutationResponse<RefreshMangaMutation> {
|
): AbortableApolloMutationResponse<RefreshMangaMutation> {
|
||||||
return this.doRequest<RefreshMangaMutation, RefreshMangaMutationVariables>(
|
return this.doRequest<RefreshMangaMutation, RefreshMangaMutationVariables>(
|
||||||
GQLMethod.MUTATION,
|
GQLMethod.MUTATION,
|
||||||
REFRESH_MANGA,
|
REFRESH_MANGA,
|
||||||
{
|
{
|
||||||
id: Number(mangaId),
|
id: Number(mangaId),
|
||||||
|
fetchManga,
|
||||||
|
fetchChapters,
|
||||||
},
|
},
|
||||||
{ refetchQueries: [GET_CHAPTERS_MANGA, GET_CHAPTERS_READER], errorPolicy: 'all', ...options },
|
{ refetchQueries: [GET_CHAPTERS_MANGA, GET_CHAPTERS_READER], ...options },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2556,18 +2543,6 @@ export class RequestManager {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMangaChaptersFetch(
|
|
||||||
mangaId: number | string,
|
|
||||||
options?: MutationOptions<GetMangaChaptersFetchMutation, GetMangaChaptersFetchMutationVariables>,
|
|
||||||
): AbortableApolloMutationResponse<GetMangaChaptersFetchMutation> {
|
|
||||||
return this.doRequest<GetMangaChaptersFetchMutation, GetMangaChaptersFetchMutationVariables>(
|
|
||||||
GQLMethod.MUTATION,
|
|
||||||
GET_MANGA_CHAPTERS_FETCH,
|
|
||||||
{ input: { mangaId: Number(mangaId) } },
|
|
||||||
{ refetchQueries: [GET_CHAPTERS_MANGA], ...options },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public useGetMangaChapter(
|
public useGetMangaChapter(
|
||||||
mangaId: number | string,
|
mangaId: number | string,
|
||||||
chapterIndex: number | string,
|
chapterIndex: number | string,
|
||||||
|
|||||||
Reference in New Issue
Block a user