Files
hydra/src/main/events/torrenting/pause-game-download.ts
Chubby Granny Chaser dc7591ee28 feat: removing sentry
2024-05-14 16:54:14 +01:00

31 lines
793 B
TypeScript

import { registerEvent } from "../register-event";
import { gameRepository } from "../../repository";
import { In } from "typeorm";
import { DownloadManager, WindowManager } from "@main/services";
import { GameStatus } from "@shared";
const pauseGameDownload = async (
_event: Electron.IpcMainInvokeEvent,
gameId: number
) => {
DownloadManager.pauseDownload();
await gameRepository
.update(
{
id: gameId,
status: In([
GameStatus.Downloading,
GameStatus.DownloadingMetadata,
GameStatus.CheckingFiles,
]),
},
{ status: GameStatus.Paused }
)
.then((result) => {
if (result.affected) WindowManager.mainWindow?.setProgressBar(-1);
});
};
registerEvent("pauseGameDownload", pauseGameDownload);