diff options
| author | Adam Soltys <[email protected]> | 2026-01-22 18:48:07 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-01-22 18:48:07 -0800 |
| commit | d147e04d1b52f1359507a6f9d88e0227cf6bb250 (patch) | |
| tree | 2eb562735a335831cec4737610f9638aaf50f32f /routes/users.ts | |
| parent | 0edd59be4bbfc62f73b972e4992ec3c31d6baab1 (diff) | |
| download | coinos-server-d147e04d1b52f1359507a6f9d88e0227cf6bb250.tar.gz coinos-server-d147e04d1b52f1359507a6f9d88e0227cf6bb250.zip | |
read payments from archive
Diffstat (limited to 'routes/users.ts')
| -rw-r--r-- | routes/users.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routes/users.ts b/routes/users.ts index 91928503..8cb24870 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -2,7 +2,7 @@ import { createReadStream } from "node:fs"; import { appendFile, unlink, writeFile } from "node:fs/promises"; import config from "$config"; import { requirePin } from "$lib/auth"; -import { db, g, ga, s } from "$lib/db"; +import { db, g, ga, gf, s } from "$lib/db"; import { err, l, warn } from "$lib/logging"; import { mail, templates } from "$lib/mail"; import { getNostrUser, getProfile, serverPubkey2 } from "$lib/nostr"; @@ -109,7 +109,7 @@ export default { let total = 0; for (const pid of payments) { - const p = await g(`payment:${pid}`); + const p = await gf(`payment:${pid}`); if (!p) continue; total += p.amount; if (p.amount < 0) @@ -571,7 +571,7 @@ export default { for (const { ref } of ( await Promise.all( - payments.reverse().map(async (id) => await g(`payment:${id}`)), + payments.reverse().map(async (id) => await gf(`payment:${id}`)), ) ).filter((p) => p && p.type === PaymentType.internal && p.ref)) { if (ref === id) continue; @@ -950,8 +950,8 @@ export default { const payments = await Promise.all( pids.map(async (pid) => { - const p = await g(`payment:${pid}`); - p.user = await g(`user:${p.uid}`); + const p = await gf(`payment:${pid}`); + if (p) p.user = await g(`user:${p.uid}`); return p; }), ); @@ -976,7 +976,7 @@ export default { const pids = await db.lRange(`${a.pubkey}:payments`, 0, -1); let payments = await Promise.all( - pids.map((pid) => g(`payment:${pid}`)), + pids.map((pid) => gf(`payment:${pid}`)), ); payments = payments.filter((p) => p); a.spent = payments.reduce( |
