1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-11 17:42:48 +00:00

update thread reply

This commit is contained in:
2018-01-04 21:06:23 -06:00
parent 148bde8f99
commit f540e7351b
7 changed files with 73 additions and 20 deletions

View File

@@ -1,11 +1,13 @@
defmodule MyApp.Data.Util do
@spec map_changeset(map) :: map
def map_changeset(changeset) do
Enum.map(changeset.errors, fn {key, val} ->
%{key => elem(val, 0)}
end)
end
@spec process_insert_or_update({atom, map}) :: {:ok, map} | {:error, map}
def process_insert_or_update({:error, changeset}), do: {:error, map_changeset(changeset)}
def process_insert_or_update({:ok, data}), do: {:ok, data}