mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
feat: add prefilling pdf form fields via api (#1086)
## Description Adds the ability to prefill native PDF form fields via the API using either normal documents or templates. Since we won't always know when a document is uploaded and has forms we opt to do this on creation for templates and on sending the document to recipients in all cases. This means that for a created document it can look a little funky since the form fields are missing the data until the document is sent. This should be improved in a later change but since we've scoped this to an API only workflow for now we are less concerned with the visual issues. ## Related Issue N/A ## Changes Made - Added the `formValues` field the document model - Added a new method for finding and filling form fields based on a `key | value` pair - Updated the API input shapes to take the new field. ## Testing Performed - Have created and tested a document using the API both for creation and usage with a template. - Have verified that the fields display as expected either during creation or sending depending on the document type.
This commit is contained in:
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Document" ADD COLUMN "formValues" JSONB;
|
||||
@ -257,6 +257,7 @@ model Document {
|
||||
userId Int
|
||||
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
authOptions Json?
|
||||
formValues Json?
|
||||
title String
|
||||
status DocumentStatus @default(DRAFT)
|
||||
Recipient Recipient[]
|
||||
|
||||
Reference in New Issue
Block a user