Correctly handle event update

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-09-04 18:24:31 +02:00
parent 6845825db2
commit f5c3dbf128
27 changed files with 493 additions and 161 deletions

View File

@@ -227,11 +227,12 @@ defmodule Mobilizon.Events do
:tracks,
:tags,
:participants,
:physical_address
:physical_address,
:picture
])}
err ->
{:error, err}
_err ->
{:error, :event_not_found}
end
end
@@ -435,7 +436,8 @@ defmodule Mobilizon.Events do
"""
def update_event(%Event{} = event, attrs) do
event
|> Event.changeset(attrs)
|> Repo.preload(:tags)
|> Event.update_changeset(attrs)
|> Repo.update()
end