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`) }