feat: create UserSubscription

This commit is contained in:
Zamitto
2024-10-15 22:40:47 -03:00
parent 8ff925fbb9
commit fe681c3af9
15 changed files with 147 additions and 17 deletions

View File

@@ -113,8 +113,8 @@ const compareFile = async (game: Game, file: AchievementFile) => {
logger.log(
"Detected change in file",
file.filePath,
currentStat.mtimeMs,
fileStats.get(file.filePath)
previousStat,
currentStat.mtimeMs
);
await processAchievementFileDiff(game, file);
} catch (err) {

View File

@@ -5,6 +5,7 @@ import {
import { HydraApi } from "../hydra-api";
import { AchievementData } from "@types";
import { UserNotLoggedInError } from "@shared";
import { logger } from "../logger";
export const getGameAchievementData = async (
objectId: string,
@@ -35,7 +36,7 @@ export const getGameAchievementData = async (
if (err instanceof UserNotLoggedInError) {
throw err;
}
logger.error("Failed to get game achievements", err);
return gameAchievementRepository
.findOne({
where: { objectId, shop },

View File

@@ -22,11 +22,15 @@ const saveAchievementsOnLocal = async (
},
["objectId", "shop"]
)
.then(async () => {
WindowManager.mainWindow?.webContents.send(
`on-update-achievements-${objectId}-${shop}`,
await getGameAchievements(objectId, shop as GameShop)
);
.then(() => {
return getGameAchievements(objectId, shop as GameShop)
.then((achievements) => {
WindowManager.mainWindow?.webContents.send(
`on-update-achievements-${objectId}-${shop}`,
achievements
);
})
.catch(() => {});
});
};