@@ -256,24 +256,6 @@ export default {
256
256
LIMIT ${ LIMIT } )`
257
257
)
258
258
}
259
-
260
- if ( meFull . noteWithdrawals ) {
261
- queries . push (
262
- `(SELECT "Withdrawl".id::text, MAX(COALESCE("Invoice"."confirmedAt", "Withdrawl".created_at)) AS "sortTime",
263
- FLOOR(MAX("Withdrawl"."msatsPaid" / 1000)) as "earnedSats",
264
- 'WithdrawlPaid' AS type
265
- FROM "Withdrawl"
266
- LEFT JOIN "InvoiceForward" ON "InvoiceForward"."withdrawlId" = "Withdrawl".id
267
- LEFT JOIN "Invoice" ON "InvoiceForward"."invoiceId" = "Invoice".id
268
- WHERE "Withdrawl"."userId" = $1
269
- AND "Withdrawl".status = 'CONFIRMED'
270
- AND "Withdrawl".created_at < $2
271
- AND ("InvoiceForward"."id" IS NULL OR "Invoice"."actionType" = 'ZAP')
272
- GROUP BY "Withdrawl".id
273
- ORDER BY "sortTime" DESC
274
- LIMIT ${ LIMIT } )`
275
- )
276
- }
277
259
}
278
260
279
261
if ( ! include . size || include . has ( 'referral' ) ) {
@@ -339,6 +321,24 @@ export default {
339
321
}
340
322
}
341
323
324
+ if ( meFull . noteWithdrawals ) {
325
+ queries . push (
326
+ `(SELECT "Withdrawl".id::text, MAX(COALESCE("Invoice"."confirmedAt", "Withdrawl".created_at)) AS "sortTime",
327
+ FLOOR(MAX("Withdrawl"."msatsPaid" / 1000)) as "earnedSats",
328
+ 'WithdrawlPaid' AS type
329
+ FROM "Withdrawl"
330
+ LEFT JOIN "InvoiceForward" ON "InvoiceForward"."withdrawlId" = "Withdrawl".id
331
+ LEFT JOIN "Invoice" ON "InvoiceForward"."invoiceId" = "Invoice".id
332
+ WHERE "Withdrawl"."userId" = $1
333
+ AND "Withdrawl".status = 'CONFIRMED'
334
+ AND "Withdrawl".created_at < $2
335
+ AND "InvoiceForward"."id" IS NULL
336
+ GROUP BY "Withdrawl".id
337
+ ORDER BY "sortTime" DESC
338
+ LIMIT ${ LIMIT } )`
339
+ )
340
+ }
341
+
342
342
if ( ! include . size || include . has ( 'streak' ) ) {
343
343
if ( meFull . noteCowboyHat ) {
344
344
queries . push (
0 commit comments