Add importing html and save it to Article
Additionally defines a wizard logic which is partially unused yet.
This commit is contained in:
19
lib/outlook/internal_tree/raw_internal_tree.ex
Normal file
19
lib/outlook/internal_tree/raw_internal_tree.ex
Normal file
@ -0,0 +1,19 @@
|
||||
defmodule Outlook.Articles.RawInternalTree do
|
||||
use Ecto.Type
|
||||
|
||||
def type, do: :string
|
||||
|
||||
def cast([] = tree) do
|
||||
{:ok, tree}
|
||||
end
|
||||
|
||||
def cast(_), do: :error
|
||||
|
||||
def load(tree) when is_binary(tree) do
|
||||
{:ok, Jason.decode!(tree, keys: :atoms!)}
|
||||
end
|
||||
|
||||
def dump([] = tree ), do: {:ok, Jason.encode!(tree)}
|
||||
def dump(_), do: :error
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user