post to /games on startGameDownload

This commit is contained in:
Zamitto 2024-06-18 21:53:20 -03:00
parent 6179fb9cf6
commit ab4cf23f97

View file

@ -12,6 +12,7 @@ import { DownloadManager } from "@main/services";
import { Not } from "typeorm";
import { steamGamesWorker } from "@main/workers";
import { createGame } from "@main/services/library-sync";
const startGameDownload = async (
_event: Electron.IpcMainInvokeEvent,
@ -94,6 +95,19 @@ const startGameDownload = async (
},
});
createGame(updatedGame!).then((response) => {
const {
id: remoteId,
playTimeInMilliseconds,
lastTimePlayed,
} = response.data;
gameRepository.update(
{ objectID },
{ remoteId, playTimeInMilliseconds, lastTimePlayed }
);
});
await downloadQueueRepository.delete({ game: { id: updatedGame!.id } });
await downloadQueueRepository.insert({ game: { id: updatedGame!.id } });