mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
34 lines
648 B
TypeScript
34 lines
648 B
TypeScript
import { GameStatus } from "@main/constants";
|
|
import { gameRepository } from "@main/repository";
|
|
|
|
import { registerEvent } from "../register-event";
|
|
|
|
const removeGameFromDownload = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
gameId: number
|
|
) => {
|
|
const game = await gameRepository.findOne({
|
|
where: {
|
|
id: gameId,
|
|
status: GameStatus.Cancelled,
|
|
},
|
|
});
|
|
|
|
if (!game) return;
|
|
|
|
gameRepository.update(
|
|
{
|
|
id: game.id,
|
|
},
|
|
{
|
|
status: null,
|
|
downloadPath: null,
|
|
bytesDownloaded: 0,
|
|
progress: 0,
|
|
}
|
|
);
|
|
};
|
|
|
|
registerEvent(removeGameFromDownload, {
|
|
name: "removeGameFromDownload",
|
|
});
|