feat: migrating games to leveldb

This commit is contained in:
Chubby Granny Chaser 2025-01-19 17:59:39 +00:00
parent c115040e90
commit 1f0e195854
No known key found for this signature in database
34 changed files with 410 additions and 343 deletions

View file

@ -1,16 +1,17 @@
import { gameRepository } from "@main/repository";
import { registerEvent } from "../register-event";
import { levelKeys } from "@main/level";
import { gamesSublevel } from "@main/level";
import type { GameShop } from "@types";
const getGameByObjectId = async (
_event: Electron.IpcMainInvokeEvent,
shop: GameShop,
objectId: string
) =>
gameRepository.findOne({
where: {
objectID: objectId,
isDeleted: false,
},
});
) => {
const gameKey = levelKeys.game(shop, objectId);
const game = await gamesSublevel.get(gameKey);
return game;
};
registerEvent("getGameByObjectId", getGameByObjectId);