feat(contracts): serve contract documents in the Vertragsunterlagen #118

Merged
sharang merged 5 commits from feat/contract-documents into main 2026-11-09 12:59:20 +00:00
5 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 7430c3a4bb fix(contracts): legal form in ag_name, no LBs from preview grants
ci / shared (pull_request) Successful in 11s
ci / test (pull_request) Successful in 25m56s
ci / image (pull_request) Skipped
ag_name is the company name with the form's label of its legal form
("Muster GmbH"), not appended when the name already ends with it
(case-insensitive; "UG" counts for the UG), nor for Einzelunternehmen,
Sonstige or no form. The e.V. is written without "(Verein)".

A staff preview grant no longer brings in a product's Leistungsbeschreibung:
only enabled, unexpired bookings and trials count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:32:17 +01:00
Sharang ParnerkarandClaude Opus 5.5 25248b7f6d fix(contracts): title the platform LB "Breakpilot Plattform"
The overview lists it as "Leistungsbeschreibung Breakpilot Plattform"; the
PDF and its pin are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:32:17 +01:00
Sharang ParnerkarandClaude Opus 5.5 1b1e52b851 feat(contracts): list and serve contract documents per tenant
ci / shared (pull_request) Successful in 14s
ci / test (pull_request) Successful in 26m45s
ci / image (pull_request) Skipped
GET /v1/tenants/{id}/contracts gains "documents": AGB, AVV, TOM and the
Leistungsbeschreibungen that apply to the tenant (platform always;
products booked, on trial or under an active preview grant; Managed Git
and Build-Runner when the tenant has that managed service). A filled AVV
of the tenant replaces the master (tenant_specific).

GET /v1/tenants/{id}/contracts/documents/{doc}.pdf serves the bytes after
the digest check. Both are empty / 404 while CONTRACT_DOCUMENTS is off.

Staff only: GET /v1/admin/tenants/{id}/avv-values derives the AVV details
from the company profile and the role dataset (never logged), PUT
/v1/admin/tenants/{id}/contract-documents/avv stores the filled PDF.
Purging a tenant removes its filled documents from the bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:55:06 +01:00
Sharang ParnerkarandClaude Opus 5.5 82a5a6ca80 feat(store): keep each tenant's filled AVV (migration 0027)
tenant_contract_documents records a workspace's own filled contract
document (for now the AVV): master version, PDF SHA-256, bucket key,
digest of the filled-in values and the staff member's Keycloak sub.
Rows are insert-only (an UPDATE trigger refuses changes); the newest per
tenant and kind is current. Memory and Postgres stores, purge with the
tenant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:55:06 +01:00
Sharang ParnerkarandClaude Opus 5.5 8faf3fe2a7 feat(contracts): embed the released Leistungsbeschreibungen
internal/legal/contractdocs holds the released contract documents as
committed PDFs with pinned SHA-256: the Leistungsbeschreibungen Breakpilot
(Plattform), Managed Git, Build-Runner, Werkpilot, Firmwerk, Werkmeister
1.0.0 and Prüfwerk 1.0.3. AGB, AVV and TOM are added later by one table
line plus their PDF. The table also says which LB applies to whom.

The pins are checked at startup (the server refuses to start on a
mismatch) and by a test; CI now runs ./internal/legal/... too.

CONTRACT_DOCUMENTS ("on"/"off", default off) is the release gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:55:06 +01:00