cleanup fix
This commit is contained in:
parent
cfb7dd1e6e
commit
bfa71f7439
2 changed files with 8 additions and 8 deletions
|
|
@ -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,15 +162,15 @@ 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', { serial_id: appUser.serial_id }, txId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const user = await this.userStorage.FindUser(baseUser, txId)
|
const user = await this.userStorage.FindUser(baseUser, txId)
|
||||||
if (!user) return
|
if (!user) return
|
||||||
await this.dbs.Delete<User>('User', user.serial_id, txId)
|
await this.dbs.Delete<User>('User', { serial_id: user.serial_id }, txId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ export default class {
|
||||||
}
|
}
|
||||||
let deleted = 0
|
let deleted = 0
|
||||||
for (const invoice of invoices) {
|
for (const invoice of invoices) {
|
||||||
deleted += await this.dbs.Delete<UserReceivingInvoice>('UserReceivingInvoice', invoice.serial_id, txId)
|
deleted += await this.dbs.Delete<UserReceivingInvoice>('UserReceivingInvoice', { serial_id: invoice.serial_id }, txId)
|
||||||
}
|
}
|
||||||
return deleted
|
return deleted
|
||||||
}
|
}
|
||||||
|
|
@ -336,7 +336,7 @@ export default class {
|
||||||
}
|
}
|
||||||
let deleted = 0
|
let deleted = 0
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
deleted += await this.dbs.Delete<UserEphemeralKey>('UserEphemeralKey', key.serial_id, txId)
|
deleted += await this.dbs.Delete<UserEphemeralKey>('UserEphemeralKey', { serial_id: key.serial_id }, txId)
|
||||||
}
|
}
|
||||||
return deleted
|
return deleted
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue