77e167b6e3
Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
760 B
Python
24 lines
760 B
Python
from app.models.event import Event
|
|
from app.schemas.list_models import EventSummary
|
|
from app.services.event_actor_user import extract_event_actor_user
|
|
|
|
|
|
def event_to_summary(event: Event) -> EventSummary:
|
|
host = event.host
|
|
return EventSummary(
|
|
id=event.id,
|
|
event_id=event.event_id,
|
|
host_id=event.host_id,
|
|
hostname=host.hostname,
|
|
display_name=host.display_name,
|
|
product_version=host.product_version,
|
|
occurred_at=event.occurred_at,
|
|
received_at=event.received_at,
|
|
category=event.category,
|
|
type=event.type,
|
|
severity=event.severity,
|
|
title=event.title,
|
|
summary=event.summary,
|
|
actor_user=extract_event_actor_user(event.type, event.details),
|
|
)
|