Add document webhook events

Add a resource-oriented set of webhook events for the document
lifecycle. Each event carries the document plus only the sub-resource
it concerns (version, signature or approval).

Events:
- document.created / updated / archived / unarchived / deleted
- document.version.created / updated / published / rejected / deleted
- document.version.signature.requested / signed / cancelled
- document.version.approval.requested / approved / rejected / voided

Wires the new types through the migration, Go enum, GraphQL schema,
CLI, n8n nodes and the console webhooks settings UI.

Signed-off-by: Sacha Al Himdani <sacha@probo.com>
This commit is contained in:
Sacha Al Himdani
2026-06-29 20:42:50 +02:00
parent 4cdf8b7913
commit 1df4af4556
11 changed files with 944 additions and 91 deletions

View File

@@ -920,7 +920,9 @@ func (p *Documents) BulkArchive(
scope Scoper,
) error {
q := `
UPDATE documents SET status = 'ARCHIVED', archived_at = @archived_at, trust_center_visibility = 'NONE' WHERE %s AND id = ANY(@document_ids)
UPDATE documents
SET status = 'ARCHIVED', archived_at = @archived_at, trust_center_visibility = 'NONE', updated_at = @updated_at
WHERE %s AND id = ANY(@document_ids)
`
q = fmt.Sprintf(q, scope.SQLFragment())
@@ -929,9 +931,11 @@ UPDATE documents SET status = 'ARCHIVED', archived_at = @archived_at, trust_cent
ids[i] = doc.ID
}
now := time.Now()
args := pgx.StrictNamedArgs{
"document_ids": ids,
"archived_at": time.Now(),
"archived_at": now,
"updated_at": now,
}
maps.Copy(args, scope.SQLArguments())
@@ -948,7 +952,7 @@ func (p *Documents) BulkUnarchive(
scope Scoper,
) error {
q := `
UPDATE documents SET status = 'ACTIVE', archived_at = NULL WHERE %s AND id = ANY(@document_ids)
UPDATE documents SET status = 'ACTIVE', archived_at = NULL, updated_at = @updated_at WHERE %s AND id = ANY(@document_ids)
`
q = fmt.Sprintf(q, scope.SQLFragment())
@@ -959,6 +963,7 @@ UPDATE documents SET status = 'ACTIVE', archived_at = NULL WHERE %s AND id = ANY
args := pgx.StrictNamedArgs{
"document_ids": ids,
"updated_at": time.Now(),
}
maps.Copy(args, scope.SQLArguments())