From bfa71f743918ccaaf9025c63224a234e8a258bd8 Mon Sep 17 00:00:00 2001 From: shocknet-justin Date: Mon, 2 Mar 2026 15:08:56 -0500 Subject: [PATCH 1/2] cleanup fix --- src/services/storage/applicationStorage.ts | 12 ++++++------ src/services/storage/paymentStorage.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/services/storage/applicationStorage.ts b/src/services/storage/applicationStorage.ts index 77438ee3..dba5b466 100644 --- a/src/services/storage/applicationStorage.ts +++ b/src/services/storage/applicationStorage.ts @@ -1,5 +1,5 @@ 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 { Application } from "./entity/Application.js" import UserStorage from './userStorage.js'; @@ -162,15 +162,15 @@ export default class { } async RemoveAppUsersAndBaseUsers(appUserIds: string[], baseUser: string, txId?: string) { - if (appUserIds.length > 0) { - const appUsers = await this.dbs.Find('ApplicationUser', { where: { identifier: In(appUserIds) } }, txId) - for (const appUser of appUsers) { - await this.dbs.Delete('ApplicationUser', appUser.serial_id, txId) + for (const appUserId of appUserIds) { + const appUser = await this.dbs.FindOne('ApplicationUser', { where: { identifier: appUserId } }, txId) + if (appUser) { + await this.dbs.Delete('ApplicationUser', { serial_id: appUser.serial_id }, txId) } } const user = await this.userStorage.FindUser(baseUser, txId) if (!user) return - await this.dbs.Delete('User', user.serial_id, txId) + await this.dbs.Delete('User', { serial_id: user.serial_id }, txId) } diff --git a/src/services/storage/paymentStorage.ts b/src/services/storage/paymentStorage.ts index 092ef8df..16f17f75 100644 --- a/src/services/storage/paymentStorage.ts +++ b/src/services/storage/paymentStorage.ts @@ -144,7 +144,7 @@ export default class { } let deleted = 0 for (const invoice of invoices) { - deleted += await this.dbs.Delete('UserReceivingInvoice', invoice.serial_id, txId) + deleted += await this.dbs.Delete('UserReceivingInvoice', { serial_id: invoice.serial_id }, txId) } return deleted } @@ -336,7 +336,7 @@ export default class { } let deleted = 0 for (const key of keys) { - deleted += await this.dbs.Delete('UserEphemeralKey', key.serial_id, txId) + deleted += await this.dbs.Delete('UserEphemeralKey', { serial_id: key.serial_id }, txId) } return deleted } From c18b79dc5033cfacd4516cccd2470a0d8427f9b3 Mon Sep 17 00:00:00 2001 From: shocknet-justin Date: Mon, 2 Mar 2026 15:10:24 -0500 Subject: [PATCH 2/2] use number --- src/services/storage/applicationStorage.ts | 4 ++-- src/services/storage/paymentStorage.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/storage/applicationStorage.ts b/src/services/storage/applicationStorage.ts index dba5b466..402e7773 100644 --- a/src/services/storage/applicationStorage.ts +++ b/src/services/storage/applicationStorage.ts @@ -165,12 +165,12 @@ export default class { for (const appUserId of appUserIds) { const appUser = await this.dbs.FindOne('ApplicationUser', { where: { identifier: appUserId } }, txId) if (appUser) { - await this.dbs.Delete('ApplicationUser', { serial_id: appUser.serial_id }, txId) + await this.dbs.Delete('ApplicationUser', appUser.serial_id, txId) } } const user = await this.userStorage.FindUser(baseUser, txId) if (!user) return - await this.dbs.Delete('User', { serial_id: user.serial_id }, txId) + await this.dbs.Delete('User', user.serial_id, txId) } diff --git a/src/services/storage/paymentStorage.ts b/src/services/storage/paymentStorage.ts index 16f17f75..092ef8df 100644 --- a/src/services/storage/paymentStorage.ts +++ b/src/services/storage/paymentStorage.ts @@ -144,7 +144,7 @@ export default class { } let deleted = 0 for (const invoice of invoices) { - deleted += await this.dbs.Delete('UserReceivingInvoice', { serial_id: invoice.serial_id }, txId) + deleted += await this.dbs.Delete('UserReceivingInvoice', invoice.serial_id, txId) } return deleted } @@ -336,7 +336,7 @@ export default class { } let deleted = 0 for (const key of keys) { - deleted += await this.dbs.Delete('UserEphemeralKey', { serial_id: key.serial_id }, txId) + deleted += await this.dbs.Delete('UserEphemeralKey', key.serial_id, txId) } return deleted }