feat(audit): record billing + contracts mutations in the audit log (PMS-117) #82

Merged
vas2000-work merged 2 commits from feat/pms-117-audit-hooks into main 2026-06-05 04:53:21 +02:00
Owner

Follow-up: instrument billing + contracts CRUD with the in-tx audit_write pattern (to_jsonb before/after + AuditCtx). Covers invoices/payments/tax-rates/payment-gateways and contracts/items/rate-cards. Secrets stripped (config_encrypted, gateway_response). tests/audit_hooks.rs 3/3; billing 2/2 + contracts 6/6 still green. clippy -D clean.

Follow-up: instrument billing + contracts CRUD with the in-tx audit_write pattern (to_jsonb before/after + AuditCtx). Covers invoices/payments/tax-rates/payment-gateways and contracts/items/rate-cards. Secrets stripped (config_encrypted, gateway_response). tests/audit_hooks.rs 3/3; billing 2/2 + contracts 6/6 still green. clippy -D clean.
feat(audit): record billing + contracts mutations in the audit log (PMS-117)
Some checks failed
Check / fmt + clippy + compile + tests (pull_request) Successful in 1m5s
Build OCI container / Build and push mokosh-api image (push) Has been cancelled
ef0ffbfff7
Follow-up now that the audit infra is on main: instrument the billing and contracts CRUD mutations with the in-transaction audit_write pattern (to_jsonb before/after snapshots on the same tx, AuditCtx from the request). Covers invoices (create, create-from-time-entries, update), payments (create, delete), tax rates, payment-gateway configs, and contracts/contract-items/rate-cards/rate-card-items.

Secrets are stripped from snapshots: payment_gateway_configs.config_encrypted and payments.gateway_response are subtracted in SQL so the trail records who changed which row, never the secret material.

tests/audit_hooks.rs asserts an invoice update and a contract update each write a correct audit row, and that a payment-gateway upsert's audit values omit config_encrypted.

#PMS-117

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge branch 'main' into feat/pms-117-audit-hooks
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + compile + tests (pull_request) Successful in 1m4s
Build OCI container / Build and push mokosh-api image (push) Successful in 3m16s
be05264d2d
vas2000-work deleted branch feat/pms-117-audit-hooks 2026-06-05 04:53:22 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!82
No description provided.