clean users table

This commit is contained in:
shocknet-justin 2026-03-02 14:56:48 -05:00
parent 7af841c330
commit be6f48427f
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

View file

@ -183,11 +183,12 @@ export default class {
await this.storage.offerStorage.DeleteUserOffers(appUserId, tx) await this.storage.offerStorage.DeleteUserOffers(appUserId, tx)
await this.storage.debitStorage.RemoveUserDebitAccess(appUserId, tx) await this.storage.debitStorage.RemoveUserDebitAccess(appUserId, tx)
await this.storage.applicationStorage.RemoveAppUserDevices(appUserId, tx) await this.storage.applicationStorage.RemoveAppUserDevices(appUserId, tx)
} }
await this.storage.paymentStorage.RemoveUserInvoices(userId, tx) await this.storage.paymentStorage.RemoveUserInvoices(userId, tx)
await this.storage.productStorage.RemoveUserProducts(userId, tx) await this.storage.productStorage.RemoveUserProducts(userId, tx)
await this.storage.paymentStorage.RemoveUserEphemeralKeys(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") this.log("Cleaned up inactive users")

View file

@ -126,4 +126,8 @@ export default class {
const lastSeenAtUnix = now - seconds const lastSeenAtUnix = now - seconds
return this.dbs.Find<UserAccess>('UserAccess', { where: { last_seen_at_unix: LessThan(lastSeenAtUnix) } }) return this.dbs.Find<UserAccess>('UserAccess', { where: { last_seen_at_unix: LessThan(lastSeenAtUnix) } })
} }
async DeleteUserAccess(userId: string, txId?: string) {
return this.dbs.Delete<UserAccess>('UserAccess', { user_id: userId }, txId)
}
} }