Merge pull request #898 from shocknet/activate-users-cleanup

cleanup fix
This commit is contained in:
Justin (shocknet) 2026-03-02 15:13:23 -05:00 committed by GitHub
commit 8576a1d138
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
import crypto from 'crypto'; import crypto from 'crypto';
import { Between, FindOperator, IsNull, LessThanOrEqual, MoreThanOrEqual, In } from "typeorm" import { Between, FindOperator, IsNull, LessThanOrEqual, MoreThanOrEqual } from "typeorm"
import { generateSecretKey, getPublicKey } from 'nostr-tools'; import { generateSecretKey, getPublicKey } from 'nostr-tools';
import { Application } from "./entity/Application.js" import { Application } from "./entity/Application.js"
import UserStorage from './userStorage.js'; import UserStorage from './userStorage.js';
@ -162,9 +162,9 @@ export default class {
} }
async RemoveAppUsersAndBaseUsers(appUserIds: string[], baseUser: string, txId?: string) { async RemoveAppUsersAndBaseUsers(appUserIds: string[], baseUser: string, txId?: string) {
if (appUserIds.length > 0) { for (const appUserId of appUserIds) {
const appUsers = await this.dbs.Find<ApplicationUser>('ApplicationUser', { where: { identifier: In(appUserIds) } }, txId) const appUser = await this.dbs.FindOne<ApplicationUser>('ApplicationUser', { where: { identifier: appUserId } }, txId)
for (const appUser of appUsers) { if (appUser) {
await this.dbs.Delete<ApplicationUser>('ApplicationUser', appUser.serial_id, txId) await this.dbs.Delete<ApplicationUser>('ApplicationUser', appUser.serial_id, txId)
} }
} }