From 9d53ea6331f4f211a0eea1c106b597ee35c48b73 Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Sun, 5 Jan 2025 13:11:11 -0300 Subject: [PATCH] Fix zap receipt query --- lib/models/zap_receipt.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/models/zap_receipt.dart b/lib/models/zap_receipt.dart index 0a51cb0..746d777 100644 --- a/lib/models/zap_receipt.dart +++ b/lib/models/zap_receipt.dart @@ -35,10 +35,8 @@ mixin ZapReceiptAdapter on Adapter { List findByRecipient( {required String pubkey, required String eventId}) { - // NOTE: This query is technically incorrect using IN, but the probability of clashing p/e IDs is extremely low - // This will be fixed with the new purplebase final result = db.select( - "SELECT z.key, data from zapReceipts z, json_each(json_extract(data, '\$.tags')) WHERE json_extract(value, '\$[0]') in ('p', 'e') and json_extract(value, '\$[1]') in (?, ?)", + "SELECT z.key, value from zapReceipts z, json_each(json_extract(data, '\$.tags')) WHERE json_extract(value, '\$[0]') = 'p' AND json_extract(value, '\$[1]') = ?AND json_extract(value, '\$[0]') = 'e' AND json_extract(value, '\$[1]') = ?", [pubkey, eventId]); return deserializeFromResult(result); }