Minor fixes

This commit is contained in:
Artur
2025-04-02 14:01:49 -03:00
parent 19a18ed1fe
commit 4549b73b73
5 changed files with 19 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ services:
magic-btcpayserver:
restart: unless-stopped
container_name: magic-btcpayserver
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.13.3-altcoins}
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:2.0.8}
expose:
- '49392'
environment:

View File

@@ -122,7 +122,7 @@ const Project: NextPage<SingleProjectPageProps> = ({ project, donationStats }) =
</span>
</li>
<li>
{donationStats.ltc.amount}LTC{' '}
{donationStats.ltc.amount} LTC{' '}
<span className="font-normal text-sm text-gray">
in {donationStats.ltc.count} donations
</span>

View File

@@ -4,6 +4,7 @@ import { redisConnection as connection } from '../config/redis'
import './workers/perk'
import './workers/membership-check'
import './workers/donation-migration'
export const perkPurchaseQueue = new Queue<PerkPurchaseWorkerData>('PerkPurchase', {
connection,

View File

@@ -69,8 +69,8 @@ export async function sendDonationConfirmationEmail({
The following describes the context of your donation:
- [${!donation.pointsAdded ? '☑️' : '⬜'}] No goods or services were received in exchange for your generous donation.
- [${donation.pointsAdded ? '☑️' : '⬜'}] In connection with your generous donation, you received ${pointsFormat.format(donation.pointsAdded)} points, valued at approximately $${(donation.pointsAdded * POINTS_REDEEM_PRICE_USD).toFixed(2)}.
- ${!donation.pointsAdded ? '☑️' : '⬜'} No goods or services were received in exchange for your generous donation.
- ${donation.pointsAdded ? '☑️' : '⬜'} In connection with your generous donation, you received ${pointsFormat.format(donation.pointsAdded)} points, valued at approximately $${(donation.pointsAdded * POINTS_REDEEM_PRICE_USD).toFixed(2)}.
${isPaidWithCrypto ? 'If you wish to receive a tax deduction for a cryptocurrency donation over $500, you MUST complete [Form 8283](https://www.irs.gov/pub/irs-pdf/f8283.pdf) and send the completed form to [info@magicgrants.org](mailto:info@magicgrants.org) to qualify for a deduction.' : ''}

View File

@@ -3,6 +3,7 @@ import { redisConnection as connection } from '../../config/redis'
import { prisma } from '../services'
import { DonationCryptoPayments } from '../types'
import { log } from '../../utils/logging'
import { Prisma } from '@prisma/client'
const globalForWorker = global as unknown as { hasInitializedWorkers: boolean }
@@ -11,11 +12,17 @@ if (!globalForWorker.hasInitializedWorkers)
'DonationMigration',
async (job) => {
// Finds unmigrated donations and updates them
log('info', '[Donation migration] Migrating old donations...')
const donations = await prisma.donation.findMany({
where: { btcPayInvoiceId: { not: null }, cryptoPayments: { equals: undefined } },
where: {
btcPayInvoiceId: { not: null },
cryptoPayments: { equals: Prisma.DbNull },
},
})
if (!donations.length) return
await Promise.all(
donations.map(async (donation) => {
const cryptoPayments: DonationCryptoPayments = [
@@ -29,7 +36,12 @@ if (!globalForWorker.hasInitializedWorkers)
await prisma.donation.update({
where: { id: donation.id },
data: { cryptoPayments, grossCryptoAmount: null, netCryptoAmount: null },
data: {
cryptoPayments,
cryptoCode: null,
grossCryptoAmount: null,
netCryptoAmount: null,
},
})
})
)