mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: migrating games to leveldb
This commit is contained in:
parent
c115040e90
commit
1f0e195854
34 changed files with 410 additions and 343 deletions
|
@ -2,18 +2,19 @@ import { gameRepository } from "@main/repository";
|
|||
|
||||
import { registerEvent } from "../register-event";
|
||||
|
||||
import type { GameShop } from "@types";
|
||||
import type { Game, GameShop } from "@types";
|
||||
|
||||
import { steamGamesWorker } from "@main/workers";
|
||||
import { createGame } from "@main/services/library-sync";
|
||||
import { steamUrlBuilder } from "@shared";
|
||||
import { updateLocalUnlockedAchivements } from "@main/services/achievements/update-local-unlocked-achivements";
|
||||
import { gamesSublevel, levelKeys } from "@main/level";
|
||||
|
||||
const addGameToLibrary = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
shop: GameShop,
|
||||
objectId: string,
|
||||
title: string,
|
||||
shop: GameShop
|
||||
title: string
|
||||
) => {
|
||||
return gameRepository
|
||||
.update(
|
||||
|
@ -36,17 +37,15 @@ const addGameToLibrary = async (
|
|||
? steamUrlBuilder.icon(objectId, steamGame.clientIcon)
|
||||
: null;
|
||||
|
||||
await gameRepository.insert({
|
||||
const game: Game = {
|
||||
title,
|
||||
iconUrl,
|
||||
objectID: objectId,
|
||||
objectId,
|
||||
shop,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const game = await gameRepository.findOne({
|
||||
where: { objectID: objectId },
|
||||
});
|
||||
await gamesSublevel.put(levelKeys.game(shop, objectId), game);
|
||||
}
|
||||
|
||||
updateLocalUnlockedAchivements(game!);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue