diff --git a/api/paidAction/itemCreate.js b/api/paidAction/itemCreate.js index 4b2b8bb9..9f6a23fb 100644 --- a/api/paidAction/itemCreate.js +++ b/api/paidAction/itemCreate.js @@ -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' }