diff --git a/src/main/events/library/sync-game-by-object-id.ts b/src/main/events/library/sync-game-by-object-id.ts index 6aa1c77b..0630ceb9 100644 --- a/src/main/events/library/sync-game-by-object-id.ts +++ b/src/main/events/library/sync-game-by-object-id.ts @@ -14,9 +14,13 @@ const syncGameByObjectId = async ( const gameKey = levelKeys.game(shop, objectId); const game = await gamesSublevel.get(gameKey); + const { id, playTimeInSeconds, ...rest } = res; + gamesSublevel.put(gameKey, { - ...(game ?? { remoteId: null }), - ...res, + ...game, + ...rest, + remoteId: id, + playTimeInMilliseconds: playTimeInSeconds * 1000, }); return res; diff --git a/src/types/index.ts b/src/types/index.ts index 2cb3618f..0a1cb713 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -344,8 +344,8 @@ export type LibraryGame = Game & }; export type UserGameDetails = ShopAssets & { - userId: string; - playTimeInMilliseconds: number; + id: string; + playTimeInSeconds: number; unlockedAchievementCount: number; achievementsPointsEarnedSum: number; lastTimePlayed: Date | null;