feat(logs): add workspace activity log api
This commit is contained in:
27
apps/logs/services/metadata.py
Normal file
27
apps/logs/services/metadata.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def build_workspace_log_metadata(
|
||||
*,
|
||||
section: str,
|
||||
workspace_id,
|
||||
target_id,
|
||||
target_label: str,
|
||||
extra: dict | None = None,
|
||||
) -> dict:
|
||||
metadata = {
|
||||
"workspace_id": str(workspace_id),
|
||||
"section": section,
|
||||
"target_id": str(target_id),
|
||||
"target_label": target_label,
|
||||
}
|
||||
if extra:
|
||||
metadata.update(
|
||||
{
|
||||
key: value
|
||||
for key, value in extra.items()
|
||||
if value is not None
|
||||
}
|
||||
)
|
||||
return metadata
|
||||
|
||||
Reference in New Issue
Block a user