Add audit functionality for Activity actions

- Introduced `ActivityDisplayer` and `ActivitySubjectConverter` for handling audit display and conversion logic.
- Integrated `TriggerAuditInterface` in `ActivityController` and added audit triggers for create, list, update, delete, and view actions with translatable descriptions.
- Updated `services.yaml` to register new audit-related services.
- Enhanced French translations with audit-related labels for `Activity`.
This commit is contained in:
2026-02-27 16:13:37 +01:00
parent 546d5bf1f7
commit e28dc355e8
6 changed files with 134 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ $this->triggerAudit->triggerAudit(
- Audit every create, update, delete, view and list action on domain entities.
- Use only the `$action` when it is obvious and self-explanatory.
- Use the `$description` when the action alone is not enough. For example for a list, the main subject is the person (or the accompanying period) the list is attached to, and the description should summarize the list content (filters, ranges, counts, …).
- The description should be a `TranslatableMessage`, and the first key of the message should be `audit`
- Add `$metadata` to provide extra, machine-friendly details (ids, filters, pagination, counts, etc.).
- Reuse the existing patterns found in current controllers and services.
@@ -84,7 +85,7 @@ Examples:
($this->triggerAudit)(
AuditTrail::AUDIT_LIST,
$accompanyingPeriod,
description: 'Listing resources for the current period',
description: new TranslatableMessage('audit.Listing resources for the current period'),
metadata: ['scope' => 'resources', 'filters' => ['category' => 'housing', 'page' => 1]]
);
```