enhance: show an error when uploads are expired (#1685)

* enhance: show an error when uploads are expired

* lint: standardjs
This commit is contained in:
soxa 2024-12-05 15:15:08 +01:00 committed by GitHub
parent e55af28763
commit 3806dc23af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,16 @@ export async function perform (args, context) {
const { tx, me, cost } = context
const boostMsats = satsToMsats(boost)
const deletedUploads = []
for (const uploadId of uploadIds) {
if (!await tx.upload.findUnique({ where: { id: uploadId } })) {
deletedUploads.push(uploadId)
}
}
if (deletedUploads.length > 0) {
throw new Error(`upload(s) ${deletedUploads.join(', ')} are expired, consider reuploading.`)
}
let invoiceData = {}
if (invoiceId) {
invoiceData = { invoiceId, invoiceActionState: 'PENDING' }