fix: async error function had too many arguments

This commit is contained in:
Moyasee
2025-09-30 02:17:17 +03:00
parent 959bed746b
commit ceb236c40c
5 changed files with 160 additions and 124 deletions

View File

@@ -4,18 +4,33 @@ import type { GameShop } from "@types";
import fs from "node:fs";
import { logger } from "@main/services";
interface UpdateCustomGameParams {
shop: GameShop;
objectId: string;
title: string;
iconUrl?: string;
logoImageUrl?: string;
libraryHeroImageUrl?: string;
originalIconPath?: string;
originalLogoPath?: string;
originalHeroPath?: string;
}
const updateCustomGame = async (
_event: Electron.IpcMainInvokeEvent,
shop: GameShop,
objectId: string,
title: string,
iconUrl?: string,
logoImageUrl?: string,
libraryHeroImageUrl?: string,
originalIconPath?: string,
originalLogoPath?: string,
originalHeroPath?: string
params: UpdateCustomGameParams
) => {
const {
shop,
objectId,
title,
iconUrl,
logoImageUrl,
libraryHeroImageUrl,
originalIconPath,
originalLogoPath,
originalHeroPath,
} = params;
const gameKey = levelKeys.game(shop, objectId);
const existingGame = await gamesSublevel.get(gameKey);

View File

@@ -32,17 +32,32 @@ const collectOldAssetPaths = (
return oldAssetPaths;
};
interface UpdateGameDataParams {
gameKey: string;
existingGame: Game;
title: string;
customIconUrl?: string | null;
customLogoImageUrl?: string | null;
customHeroImageUrl?: string | null;
customOriginalIconPath?: string | null;
customOriginalLogoPath?: string | null;
customOriginalHeroPath?: string | null;
}
const updateGameData = async (
gameKey: string,
existingGame: Game,
title: string,
customIconUrl?: string | null,
customLogoImageUrl?: string | null,
customHeroImageUrl?: string | null,
customOriginalIconPath?: string | null,
customOriginalLogoPath?: string | null,
customOriginalHeroPath?: string | null
params: UpdateGameDataParams
): Promise<Game> => {
const {
gameKey,
existingGame,
title,
customIconUrl,
customLogoImageUrl,
customHeroImageUrl,
customOriginalIconPath,
customOriginalLogoPath,
customOriginalHeroPath,
} = params;
const updatedGame = {
...existingGame,
title,
@@ -86,18 +101,33 @@ const deleteOldAssetFiles = async (oldAssetPaths: string[]): Promise<void> => {
}
};
interface UpdateGameCustomAssetsParams {
shop: GameShop;
objectId: string;
title: string;
customIconUrl?: string | null;
customLogoImageUrl?: string | null;
customHeroImageUrl?: string | null;
customOriginalIconPath?: string | null;
customOriginalLogoPath?: string | null;
customOriginalHeroPath?: string | null;
}
const updateGameCustomAssets = async (
_event: Electron.IpcMainInvokeEvent,
shop: GameShop,
objectId: string,
title: string,
customIconUrl?: string | null,
customLogoImageUrl?: string | null,
customHeroImageUrl?: string | null,
customOriginalIconPath?: string | null,
customOriginalLogoPath?: string | null,
customOriginalHeroPath?: string | null
params: UpdateGameCustomAssetsParams
) => {
const {
shop,
objectId,
title,
customIconUrl,
customLogoImageUrl,
customHeroImageUrl,
customOriginalIconPath,
customOriginalLogoPath,
customOriginalHeroPath,
} = params;
const gameKey = levelKeys.game(shop, objectId);
const existingGame = await gamesSublevel.get(gameKey);
@@ -112,7 +142,7 @@ const updateGameCustomAssets = async (
customHeroImageUrl
);
const updatedGame = await updateGameData(
const updatedGame = await updateGameData({
gameKey,
existingGame,
title,
@@ -121,8 +151,8 @@ const updateGameCustomAssets = async (
customHeroImageUrl,
customOriginalIconPath,
customOriginalLogoPath,
customOriginalHeroPath
);
customOriginalHeroPath,
});
await updateShopAssets(gameKey, title);