Fix territory edits (#2403)

This commit is contained in:
ekzyis 2025-08-08 01:59:53 +02:00 committed by GitHub
parent 44992fd1bf
commit 7a7ed1745c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ export const paymentMethods = [
export async function getCost ({ billingType, uploadIds }, { models, me }) { export async function getCost ({ billingType, uploadIds }, { models, me }) {
const { totalFees } = await uploadFees(uploadIds, { models, me }) const { totalFees } = await uploadFees(uploadIds, { models, me })
return satsToMsats(TERRITORY_PERIOD_COST(billingType) + totalFees) return satsToMsats(BigInt(TERRITORY_PERIOD_COST(billingType)) + totalFees)
} }
export async function perform ({ invoiceId, ...data }, { me, cost, tx }) { export async function perform ({ invoiceId, ...data }, { me, cost, tx }) {

View File

@ -66,9 +66,9 @@ export async function uploadFees (s3Keys, { models, me }) {
nUnpaid, nUnpaid,
uploadFeesMsats uploadFeesMsats
}] = await models.$queryRaw`SELECT * FROM upload_fees(${me?.id ?? USER_ID.anon}::INTEGER, ${s3Keys}::INTEGER[])` }] = await models.$queryRaw`SELECT * FROM upload_fees(${me?.id ?? USER_ID.anon}::INTEGER, ${s3Keys}::INTEGER[])`
const uploadFees = msatsToSats(uploadFeesMsats) const uploadFees = BigInt(msatsToSats(uploadFeesMsats))
const totalFeesMsats = BigInt(nUnpaid) * uploadFeesMsats const totalFeesMsats = BigInt(nUnpaid) * uploadFeesMsats
const totalFees = msatsToSats(totalFeesMsats) const totalFees = BigInt(msatsToSats(totalFeesMsats))
return { bytes24h, bytesUnpaid, nUnpaid, uploadFees, totalFees, totalFeesMsats } return { bytes24h, bytesUnpaid, nUnpaid, uploadFees, totalFees, totalFeesMsats }
} }