feat: add revision support to template API endpoints

Add optional 'revision' parameter to PUT /api/templates/:id and
PUT /api/templates/:id/documents. When present, creates a template
version snapshot (same mechanism as the UI editor's Save button).

This enables API consumers (e.g., deploy-docuseal.py) to create
revision history entries when updating templates programmatically.

Usage: include "revision": true in the request body.
Omit the parameter to skip version creation (backwards compatible).
pull/681/head
Sebastian Noe 1 month ago
parent 97462400e2
commit 51a9cb5557

@ -71,6 +71,8 @@ module Api
WebhookUrls.enqueue_events(@template, 'template.updated')
WebhookUrls.enqueue_events(@template, 'template.archived') if archived == true
TemplateVersions.find_or_create_for(@template, author: current_user) if params[:revision].present?
render json: @template.as_json(only: %i[id updated_at])
end

@ -22,6 +22,8 @@ module Api
SearchEntries.enqueue_reindex(@template)
WebhookUrls.enqueue_events(@template, 'template.updated')
TemplateVersions.find_or_create_for(@template, author: current_user) if params[:revision].present?
render json: Templates::SerializeForApi.call(@template)
end

Loading…
Cancel
Save