@@ -285,6 +285,7 @@ export class Mangas {
|
|||||||
mode: MigrateMode,
|
mode: MigrateMode,
|
||||||
mangaToMigrate: GetMangaToMigrateQuery['manga'],
|
mangaToMigrate: GetMangaToMigrateQuery['manga'],
|
||||||
mangaToMigrateToInfo: GetMangaToMigrateToFetchMutation,
|
mangaToMigrateToInfo: GetMangaToMigrateToFetchMutation,
|
||||||
|
deleteChapters: boolean,
|
||||||
): MigrateFuncReturn {
|
): MigrateFuncReturn {
|
||||||
if (!mangaToMigrate.chapters || !mangaToMigrateToInfo.fetchChapters?.chapters) {
|
if (!mangaToMigrate.chapters || !mangaToMigrateToInfo.fetchChapters?.chapters) {
|
||||||
throw new Error('Chapters are missing');
|
throw new Error('Chapters are missing');
|
||||||
@@ -320,9 +321,11 @@ export class Mangas {
|
|||||||
cleanup: () =>
|
cleanup: () =>
|
||||||
mode === 'migrate'
|
mode === 'migrate'
|
||||||
? [
|
? [
|
||||||
requestManager.deleteDownloadedChapters(
|
deleteChapters
|
||||||
Chapters.getIds(Chapters.getDownloaded(mangaToMigrate.chapters?.nodes ?? [])),
|
? requestManager.deleteDownloadedChapters(
|
||||||
).response,
|
Chapters.getIds(Chapters.getDownloaded(mangaToMigrate.chapters?.nodes ?? [])),
|
||||||
|
).response
|
||||||
|
: Promise.resolve(),
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
@@ -461,7 +464,10 @@ export class Mangas {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await performMigrationActions(
|
await performMigrationActions(
|
||||||
[migrateChapters, Mangas.migrateChapters(mode, mangaToMigrateData.manga, mangaToMigrateToData)],
|
[
|
||||||
|
migrateChapters,
|
||||||
|
Mangas.migrateChapters(mode, mangaToMigrateData.manga, mangaToMigrateToData, !!deleteChapters),
|
||||||
|
],
|
||||||
[
|
[
|
||||||
migrateTracking,
|
migrateTracking,
|
||||||
Mangas.migrateTracking(mode, mangaToMigrateData.manga, mangaToMigrateToData.fetchManga.manga),
|
Mangas.migrateTracking(mode, mangaToMigrateData.manga, mangaToMigrateToData.fetchManga.manga),
|
||||||
|
|||||||
Reference in New Issue
Block a user