@@ -256,6 +256,24 @@ 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
272
+ GROUP BY "Withdrawl".id
273
+ ORDER BY "sortTime" DESC
274
+ LIMIT ${ LIMIT } )`
275
+ )
276
+ }
259
277
}
260
278
261
279
if ( ! include . size || include . has ( 'referral' ) ) {
@@ -321,24 +339,6 @@ export default {
321
339
}
322
340
}
323
341
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