From 2e5a324669249081ce0e2996699e74faa069f716 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Wed, 19 Jun 2024 00:07:15 -0300 Subject: [PATCH] clear remote ids on sign in --- src/main/services/hydra-api.ts | 2 ++ src/main/services/library-sync/clear-games-remote-id.ts | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 src/main/services/library-sync/clear-games-remote-id.ts diff --git a/src/main/services/hydra-api.ts b/src/main/services/hydra-api.ts index 5e8e74b8..b398cbd8 100644 --- a/src/main/services/hydra-api.ts +++ b/src/main/services/hydra-api.ts @@ -3,6 +3,7 @@ import axios, { AxiosError, AxiosInstance } from "axios"; import { WindowManager } from "./window-manager"; import url from "url"; import { uploadGamesBatch } from "./library-sync"; +import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id"; export class HydraApi { private static instance: AxiosInstance; @@ -50,6 +51,7 @@ export class HydraApi { if (WindowManager.mainWindow) { WindowManager.mainWindow.webContents.send("on-signin"); + await clearGamesRemoteIds(); uploadGamesBatch(); } } diff --git a/src/main/services/library-sync/clear-games-remote-id.ts b/src/main/services/library-sync/clear-games-remote-id.ts new file mode 100644 index 00000000..f26d65f1 --- /dev/null +++ b/src/main/services/library-sync/clear-games-remote-id.ts @@ -0,0 +1,5 @@ +import { gameRepository } from "@main/repository"; + +export const clearGamesRemoteIds = () => { + return gameRepository.update({}, { remoteId: null }); +};