mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
fix: improving adding soft deleted games to the library
This commit is contained in:
parent
6b7302ceac
commit
59b1f2d5a5
@ -13,34 +13,33 @@ const addGameToLibrary = async (
|
|||||||
gameShop: GameShop,
|
gameShop: GameShop,
|
||||||
executablePath: string | null
|
executablePath: string | null
|
||||||
) => {
|
) => {
|
||||||
const game = await gameRepository.findOne({
|
return gameRepository
|
||||||
where: {
|
.update(
|
||||||
objectID,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (game) {
|
|
||||||
return gameRepository.update(
|
|
||||||
{
|
{
|
||||||
id: game.id,
|
objectID,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
shop: gameShop,
|
shop: gameShop,
|
||||||
|
status: null,
|
||||||
executablePath,
|
executablePath,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
} else {
|
.then(async ({ affected }) => {
|
||||||
const iconUrl = await getFileBase64(await getSteamGameIconUrl(objectID));
|
if (!affected) {
|
||||||
|
const iconUrl = await getFileBase64(
|
||||||
|
await getSteamGameIconUrl(objectID)
|
||||||
|
);
|
||||||
|
|
||||||
return gameRepository.insert({
|
await gameRepository.insert({
|
||||||
title,
|
title,
|
||||||
iconUrl,
|
iconUrl,
|
||||||
objectID,
|
objectID,
|
||||||
shop: gameShop,
|
shop: gameShop,
|
||||||
executablePath,
|
executablePath,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
registerEvent(addGameToLibrary, {
|
registerEvent(addGameToLibrary, {
|
||||||
|
Loading…
Reference in New Issue
Block a user