feat: strengthen transactional audit delivery
This commit is contained in:
@@ -21,6 +21,7 @@ from govoplan_core.core.events import (
|
||||
ensure_event_trace,
|
||||
publish_platform_event,
|
||||
)
|
||||
from govoplan_core.core.institutional import GovernedContextEnvelope
|
||||
|
||||
EventDispatcher = Callable[[PlatformEvent], None]
|
||||
|
||||
@@ -562,6 +563,19 @@ def _event_from_payload(payload: Mapping[str, Any]) -> PlatformEvent:
|
||||
subject=_object_ref(payload.get("subject")),
|
||||
resource=_object_ref(payload.get("resource")),
|
||||
classification=cast(EventClassification, str(payload.get("classification") or "internal")),
|
||||
institutional_context=_institutional_context(
|
||||
payload.get("institutional_context")
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _institutional_context(
|
||||
value: object,
|
||||
) -> GovernedContextEnvelope | None:
|
||||
return (
|
||||
GovernedContextEnvelope.from_mapping(value)
|
||||
if isinstance(value, Mapping)
|
||||
else None
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user