Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

BaseEvent

Base class for all events in the system.

All events must have:

  • type: The type of the event (e.g., 'user', 'experiment', 'project', 'system')
  • action: The action that occurred (e.g., 'created', 'updated', 'activated')
  • data: The main data of the event (e.g., the entity or data involved)
  • timestamp: When the event occurred
  • triggered_by: The user who triggered this action (None for system actions)

Example: @dataclass class UserCreatedEvent(BaseEvent): type: Literal['user'] = 'user' action: Literal['created'] = 'created' data: User = None triggered_by: User | None = None

Attributes
action: strdata: anytimestamp: datetimetriggered_by: User | Nonetype: str
Functions
__init__

Initialize self. See help(type(self)) for accurate signature.

type : str - ''
action : str - ''
data : any
timestamp : datetime - <factory>
triggered_by : User | None
get_event_name

Get the full event name in format 'type.action'

Return type : str
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.