mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: improving adding soft deleted games to the library
This commit is contained in:
parent
6b7302ceac
commit
59b1f2d5a5
1 changed files with 18 additions and 19 deletions
|
@ -13,27 +13,25 @@ const addGameToLibrary = async (
|
|||
gameShop: GameShop,
|
||||
executablePath: string | null
|
||||
) => {
|
||||
const game = await gameRepository.findOne({
|
||||
where: {
|
||||
objectID,
|
||||
},
|
||||
});
|
||||
|
||||
if (game) {
|
||||
return gameRepository.update(
|
||||
return gameRepository
|
||||
.update(
|
||||
{
|
||||
id: game.id,
|
||||
objectID,
|
||||
},
|
||||
{
|
||||
shop: gameShop,
|
||||
status: null,
|
||||
executablePath,
|
||||
isDeleted: false,
|
||||
}
|
||||
)
|
||||
.then(async ({ affected }) => {
|
||||
if (!affected) {
|
||||
const iconUrl = await getFileBase64(
|
||||
await getSteamGameIconUrl(objectID)
|
||||
);
|
||||
} else {
|
||||
const iconUrl = await getFileBase64(await getSteamGameIconUrl(objectID));
|
||||
|
||||
return gameRepository.insert({
|
||||
await gameRepository.insert({
|
||||
title,
|
||||
iconUrl,
|
||||
objectID,
|
||||
|
@ -41,6 +39,7 @@ const addGameToLibrary = async (
|
|||
executablePath,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
registerEvent(addGameToLibrary, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue