-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/add more commands events (#523)
- Loading branch information
1 parent
3acf3db
commit f61fc25
Showing
25 changed files
with
450 additions
and
148 deletions.
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
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
export type UUID = `${string}-${string}-${string}-${string}-${string}`; | ||
|
||
export interface Node { | ||
uuid?: UUID; | ||
temp_id?: UUID; | ||
uuid: UUID; | ||
content: string; | ||
creator_id?: number; | ||
parent_id?: UUID; | ||
prev_id?: UUID; | ||
event_id?: UUID; | ||
dirty?: boolean; | ||
} |
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 |
---|---|---|
|
@@ -5,6 +5,6 @@ defmodule Radiator.EventStore do | |
|
||
def persist_event(event) do | ||
# persist event | ||
{:ok, event} | ||
event | ||
end | ||
end |
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
13 changes: 13 additions & 0 deletions
13
lib/radiator/outline/command/change_node_content_command.ex
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,13 @@ | ||
defmodule Radiator.Outline.Command.ChangeNodeContentCommand do | ||
@moduledoc """ | ||
Command to move a nodeinside the outline to another place. | ||
""" | ||
@type t() :: %__MODULE__{ | ||
event_id: binary(), | ||
user_id: binary(), | ||
node_id: binary(), | ||
content: String.t() | nil | ||
} | ||
|
||
defstruct [:event_id, :user_id, :node_id, :content] | ||
end |
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,23 @@ | ||
defmodule Radiator.Outline.Command.DeleteNodeCommand do | ||
@moduledoc """ | ||
Command to remove a node from the outline and delete it permantly. | ||
""" | ||
@type t() :: %__MODULE__{ | ||
event_id: binary(), | ||
user_id: binary(), | ||
node_id: binary() | ||
} | ||
|
||
defstruct [:event_id, :user_id, :node_id] | ||
|
||
# def execute(%{id: id}) do | ||
# case Radiator.Outline.Node.get(id) do | ||
# nil -> | ||
# {:error, "Node not found"} | ||
|
||
# node -> | ||
# Radiator.Outline.Node.delete(node) | ||
# {:ok, %{}} | ||
# end | ||
# end | ||
end |
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,14 @@ | ||
defmodule Radiator.Outline.Command.MoveNodeCommand do | ||
@moduledoc """ | ||
Command to move a nodeinside the outline to another place. | ||
""" | ||
@type t() :: %__MODULE__{ | ||
event_id: binary(), | ||
user_id: binary(), | ||
node_id: binary(), | ||
parent_node_id: binary() | nil, | ||
prev_node_id: binary() | nil | ||
} | ||
|
||
defstruct [:event_id, :user_id, :node_id, :parent_node_id, :prev_node_id] | ||
end |
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,5 @@ | ||
defmodule Radiator.Outline.Event.NodeContentChangedEvent do | ||
@moduledoc false | ||
|
||
defstruct [:event_id, :node] | ||
end |
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,3 @@ | ||
defmodule Radiator.Outline.Event.NodeDeletedEvent do | ||
@moduledoc false | ||
end |
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,3 @@ | ||
defmodule Radiator.Outline.Event.NodeMovedEvent do | ||
@moduledoc false | ||
end |
Oops, something went wrong.