diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/app.ts | 5 | ||||
| -rw-r--r-- | lib/db.ts | 1 | ||||
| -rw-r--r-- | lib/payments.ts | 1 |
3 files changed, 6 insertions, 1 deletions
@@ -81,7 +81,10 @@ app.register(fastifyStatic, { prefix: "/public/", }); -await app.register(cors, { origin: true }); +await app.register(cors, { + origin: true, + credentials: true, +}); app.setErrorHandler((error, _, reply) => { if (error instanceof fastify.errorCodes.FST_ERR_BAD_STATUS_CODE) { @@ -48,6 +48,7 @@ if redis.call('exists', paymentKey) == 1 then redis.call('incrby', creditKey, credit) redis.call('del', hashKey) redis.call('lrem', paymentsKey, 0, pid) + redis.call('lrem', 'payments', 0, pid) return pid else error("Payment has already been reversed" .. paymentKey) diff --git a/lib/payments.ts b/lib/payments.ts index 9c9f1794..437db14f 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -160,6 +160,7 @@ export const debit = async ({ await s(`payment:${id}`, p); await db .multi() + .lPush("payments", id) .lPush(`${aid || uid}:payments`, id) .set(`${aid || uid}:payments:last`, p.created) .exec(); |
