From 3a6dcb6d775f331620f9fe7c276bb0251bb99271 Mon Sep 17 00:00:00 2001 From: boufni95 Date: Tue, 25 Jul 2023 16:26:10 +0200 Subject: [PATCH] use serial id --- src/services/storage/applicationStorage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/storage/applicationStorage.ts b/src/services/storage/applicationStorage.ts index aea2373b..93a1891f 100644 --- a/src/services/storage/applicationStorage.ts +++ b/src/services/storage/applicationStorage.ts @@ -60,8 +60,8 @@ export default class { }) } - GetApplicationUserIfExists(application: Application, userIdentifier: string, entityManager = this.DB): Promise { - return entityManager.getRepository(ApplicationUser).findOne({ where: { identifier: userIdentifier, application: application } }) + async GetApplicationUserIfExists(application: Application, userIdentifier: string, entityManager = this.DB): Promise { + return entityManager.getRepository(ApplicationUser).findOne({ where: { identifier: userIdentifier, application: { serial_id: application.serial_id } } }) } async GetOrCreateApplicationUser(application: Application, userIdentifier: string, balance: number, entityManager = this.DB): Promise<{ user: ApplicationUser, created: boolean }> { @@ -75,7 +75,7 @@ export default class { async GetApplicationUser(application: Application, userIdentifier: string, entityManager = this.DB): Promise { const found = await this.GetApplicationUserIfExists(application, userIdentifier, entityManager) if (!found) { - getLogger({ appName: application.name })("user", userIdentifier, "not found") + getLogger({ appName: application.name })("user", userIdentifier, "not found", application.name) throw new Error(`application user not found`) }