-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
todo * find a better name * missing user id for events * implement for all events * want to store also old content, ids etc. ?
- Loading branch information
1 parent
7dbb521
commit dd92520
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defprotocol Radiator.Outline.Event.AbstractEvent do | ||
def payload(event) | ||
def event_type(event) | ||
def event_id(event) | ||
end | ||
|
||
alias Radiator.Outline.Event.{NodeContentChangedEvent, NodeInsertedEvent} | ||
|
||
defimpl Radiator.Outline.Event.AbstractEvent, for: NodeInsertedEvent do | ||
def payload(event) do | ||
event.node | ||
end | ||
|
||
def event_type(_event), do: "NodeInsertedEvent" | ||
def event_id(event), do: event.event_id | ||
end | ||
|
||
defimpl Radiator.Outline.Event.AbstractEvent, for: NodeContentChangedEvent do | ||
def payload(event) do | ||
event.node | ||
end | ||
|
||
def event_type(_event), do: "NodeInsertedEvent" | ||
def event_id(event), do: event.event_id | ||
end | ||
|
||
# defmodule Radiator.Outline.Event.AbstractEvent do | ||
# @callback payload(event :: any()) :: map() | ||
# @callback event_type(event :: any()) :: String.t() | ||
# end |