Commit Graph

27 Commits

Author SHA1 Message Date
Sacha Al Himdani
25c590ffe6 Add background PDF generation for published document versions
Move PDF generation from synchronous publish flow to a background polling
job. Published versions with file_id IS NULL are picked up by the job,
which generates the PDF, uploads to S3, and links the file. Export PDF
now serves stored files for published versions (with optional signature
page and watermark) and generates on the fly for drafts.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-23 20:50:25 +02:00
Sacha Al Himdani
c635492f75 SOA as document: replace export with publish workflow
Statements of Applicability are no longer exported as one-off PDFs.
Instead, each SOA owns a persistent document that accumulates versions
over time, following the same publish/approve lifecycle as authored
documents.

Publishing without approvers publishes immediately; publishing with
approvers creates a draft pending approval via the existing quorum
system. SOAs can also store default approvers that are pre-populated in
the publish dialog.

The SOA is removed from the snapshot system — applicability statements
are now queried directly (snapshot_id IS NULL) rather than through
snapshot copies.

A standalone migration script (cmd/migrate-soa-snapshots-to-documents)
converts existing SOA snapshots into documents with proper ProseMirror
content, preserving version history and approval decisions.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-16 00:01:13 +02:00
Sacha Al Himdani
0b9686fc43 Prevent duplicate active document versions
Replace the draft-only unique index with one covering both DRAFT and
PENDING_APPROVAL statuses, ensuring a document can have at most one
active version at a time. Deduplicate any existing data before creating
the index, prioritizing PENDING_APPROVAL over DRAFT.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-15 14:39:27 +02:00
Sacha Al Himdani
ab5f42ad74 Redesign document approval flow
Replace the per-approver add/remove model with a quorum-based approval
system. Documents now have default approvers that are pre-populated when
requesting approval, and the publish dialog lets users adjust the list
before submitting.

Key changes:

- Add PENDING_APPROVAL document version status with dedicated transitions
- Introduce approval quorums with request/approve/reject/void lifecycle
- Add default approvers per document (stored in document_default_approvers)
  with MERGE-based upsert for efficient sync
- Add NoDuplicates validator for slice fields
- Split ALTER TYPE ADD VALUE migrations into separate files (required by
  PostgreSQL when run inside transactions)
- Use VOIDED consistently for both quorum status and decision state enums
- Expose void/approve/reject through GraphQL and MCP, with e2e tests
- Add approval management UI: publish dialog with approver selection,
  approval list with void support, and external approve/reject page

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 18:18:30 +02:00
Bryan Frimin
f17fb7bf49 Upgrade to kit v0.3.0
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-03 11:56:06 +02:00
Sacha Al Himdani
9a418a7711 Move document type from document to document version
Follow the same pattern used for classification: document type now lives
exclusively on DocumentVersion. A migration copies existing values from
documents to their versions. The document filter uses a subquery on the
latest version. All three API surfaces (GraphQL, MCP, CLI), resolvers,
frontend, and e2e tests are updated accordingly.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-02 16:32:38 +02:00
Sacha Al Himdani
68bc8cf59a Add major.minor document versioning
Introduce a two-part version scheme (major.minor) for documents.
Drafts start at 0.1 and increment minor on each new draft. Publishing
as minor keeps the current version, publishing as major bumps to the
next major.0. Both current_published_major and current_published_minor
are tracked on the document for exact version lookups.

Signatures and approval quorums aggregate across all versions sharing
the same major number using CTE joins. Approval page mutations spread
the decision fragment so Relay updates the version row state without
requiring a page refresh.

GraphQL, MCP, and service layer expose separate publishMajor and
publishMinor mutations instead of a single mutation with a type enum.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-30 18:54:28 +02:00
Sacha Al Himdani
999171a626 Add document approval workflow
Introduce a complete approval system for document publishing. Document
versions can now require approval from selected reviewers before being
published, with automatic publishing once all approvers have approved.

- Add approval quorum and decision tables with backfill migration
- Implement request approval, approve, and reject flows with electronic
  signature support for approve decisions
- Add employee approvals page with dedicated tab and pending approvals view
- Add changelog field to publish and request approval flows
- Pre-select previous version's approvers in the publish dialog
- Show quorum approvers in document list with 100 approver hard limit
- Expose approval workflow through GraphQL, MCP, and CLI
- Remove legacy default approvers feature entirely
- Add comprehensive e2e test coverage for approval workflows

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-27 19:43:20 +01:00
Sacha Al Himdani
8c02c53315 Update copyright headers across all Go files
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-25 17:38:32 +01:00
Sacha Al Himdani
1db8e7133e Add document archiving
Documents can be archived and unarchived. Archived documents are
read-only, excluded from the trust center, and moved to a dedicated
Archived tab in the document list.

- Add archived_at timestamp and status (ACTIVE/ARCHIVED) PG enum column
- Rename DocumentStatus → DocumentVersionStatus, introduce DocumentStatus
- Archive/unarchive mutations in GraphQL, MCP, and CLI
- Bulk archive/unarchive mutations with Active/Archived tabs in the list
- ABAC policies: write actions denied on archived docs, unarchive denied
  on active docs
- Remove control/risk mappings and reset trust center visibility on archive
- Exclude archived documents from mapping dialogs and trust center tab

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-19 14:15:54 +01:00
Bryan Frimin
93c7b0c2dc Add multi-approver support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-17 10:48:44 +01:00
Bryan Frimin
3d8c7c4dd6 Rename owner by approver
Document owner does not make sense it's more an document approver.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-17 10:48:43 +01:00
Émile Ré
d7e1703ff3 Fix coredata SQL queries using new FKs columms
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:10 +04:00
Émile Ré
e156a428d4 Stop using coredata.People except for people service and people page resolvers
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:09 +04:00
Émile Ré
fb09bed247 Refactor document detail to document layout
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-01-27 17:52:58 +04:00
Bryan Frimin
4013b00841 Refactor policies document
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-01-17 11:37:39 -08:00
Bryan Frimin
74fc3b8cd1 Rewrite identity and access management
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-01-17 10:07:34 -08:00
Sacha Al Himdani
975d16c623 Add employee page
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-12-09 15:33:05 +01:00
Sacha Al Himdani
21c4b7cd9d Add role management
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-11-13 17:11:22 +01:00
Bryan Frimin
59aa332ab5 Move to vanity import url
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-10-31 17:01:52 +01:00
Sacha Al Himdani
9a33f7b771 Manage errors
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-10-31 15:14:56 +01:00
Bryan Frimin
c7cabf23de Add document classification
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-10-22 17:02:39 +02:00
Sacha Al Himdani
533822b60d Decouple users from people
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-09-23 13:50:41 +02:00
Sacha Al Himdani
a43328560a Better handling of document versions
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-08-11 13:28:22 +02:00
Sacha Al Himdani
9afb80d5e8 Remove document version from trust API
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-08-06 16:34:43 +02:00
Sacha Al Himdani
b54cb6d3fc Change document version
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-04 16:53:55 -07:00
Sacha Al Himdani
e1b4079e1f Rename policy to document
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-05-30 13:53:14 -07:00