Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: revalidate links after document uploaded
Marc Seitz0f49afdd57a3
diff --git a/jobs/convert-pdf-to-image.ts b/jobs/convert-pdf-to-image.tsindex 668bd971..1d5cb38e 100644--- a/jobs/convert-pdf-to-image.ts+++ b/jobs/convert-pdf-to-image.ts@@ -233,8 +233,8 @@ client.defineJob({},});- if (payload.versionNumber) {- const { versionNumber, documentId } = payload;+ const { versionNumber, documentId } = payload;+ if (versionNumber) {// after all pages are uploaded, update all other versions to be not primaryawait io.runTask("update-version-number", async () => {return prisma.documentVersion.updateMany({@@ -249,14 +249,25 @@ client.defineJob({},});});-- await io.runTask("initiate-link-revalidation", async () => {- await fetch(- `${process.env.NEXTAUTH_URL}/api/revalidate?secret=${process.env.REVALIDATE_TOKEN}&documentId=${documentId}`,- );- });}+ // STATUS: enabled-pages+ await processingDocumentStatus.update("revalidate-links", {+ //set data, this overrides the previous value+ state: "loading",+ data: {+ text: "Revalidating link...",+ progress: 1,+ },+ });++ // initialize link revalidation for all the document's links+ await io.runTask("initiate-link-revalidation", async () => {+ await fetch(+ `${process.env.NEXTAUTH_URL}/api/revalidate?secret=${process.env.REVALIDATE_TOKEN}&documentId=${documentId}`,+ );+ });+// STATUS: successawait processingDocumentStatus.update("success", {state: "success",