diff --git a/src/services/main/appUserManager.ts b/src/services/main/appUserManager.ts index b81f8e2e..8bb56e21 100644 --- a/src/services/main/appUserManager.ts +++ b/src/services/main/appUserManager.ts @@ -183,11 +183,12 @@ export default class { await this.storage.offerStorage.DeleteUserOffers(appUserId, tx) await this.storage.debitStorage.RemoveUserDebitAccess(appUserId, tx) await this.storage.applicationStorage.RemoveAppUserDevices(appUserId, tx) - } await this.storage.paymentStorage.RemoveUserInvoices(userId, tx) await this.storage.productStorage.RemoveUserProducts(userId, tx) await this.storage.paymentStorage.RemoveUserEphemeralKeys(userId, tx) + await this.storage.userStorage.DeleteUserAccess(userId, tx) + await this.storage.applicationStorage.RemoveAppUsersAndBaseUsers(appUserIds, userId, tx) }) } this.log("Cleaned up inactive users") diff --git a/src/services/storage/userStorage.ts b/src/services/storage/userStorage.ts index d3453346..a1541bac 100644 --- a/src/services/storage/userStorage.ts +++ b/src/services/storage/userStorage.ts @@ -126,4 +126,8 @@ export default class { const lastSeenAtUnix = now - seconds return this.dbs.Find('UserAccess', { where: { last_seen_at_unix: LessThan(lastSeenAtUnix) } }) } + + async DeleteUserAccess(userId: string, txId?: string) { + return this.dbs.Delete('UserAccess', { user_id: userId }, txId) + } }