feat: adding download queue

This commit is contained in:
Chubby Granny Chaser
2024-06-04 15:33:47 +01:00
parent 0b68ddda78
commit 73b4b2c13c
27 changed files with 615 additions and 458 deletions

View File

@@ -4,7 +4,8 @@ import { registerEvent } from "../register-event";
import type { GameShop } from "@types";
import { getFileBase64, getSteamAppAsset } from "@main/helpers";
import { stateManager } from "@main/state-manager";
import { steamGamesWorker } from "@main/workers";
const addGameToLibrary = async (
_event: Electron.IpcMainInvokeEvent,
@@ -27,9 +28,9 @@ const addGameToLibrary = async (
)
.then(async ({ affected }) => {
if (!affected) {
const steamGame = stateManager
.getValue("steamGames")
.find((game) => game.id === Number(objectID));
const steamGame = await steamGamesWorker.run(Number(objectID), {
name: "getById",
});
const iconUrl = steamGame?.clientIcon
? getSteamAppAsset("icon", objectID, steamGame.clientIcon)

View File

@@ -6,8 +6,11 @@ const getLibrary = async () =>
where: {
isDeleted: false,
},
relations: {
downloadQueue: true,
},
order: {
updatedAt: "desc",
createdAt: "desc",
},
});