Fix credo style reports following it's update

Mainly transform `with` into `case`

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-07-23 18:06:22 +02:00
parent 1cd511f440
commit c3cca5d613
26 changed files with 303 additions and 248 deletions

View File

@@ -35,10 +35,17 @@ defmodule MobilizonWeb.Resolvers.Picture do
@spec do_fetch_picture(String.t()) :: {:ok, Picture.t()} | {:error, :not_found}
defp do_fetch_picture(picture_id) do
with %Picture{id: id, file: file} = _pic <- Media.get_picture(picture_id) do
{:ok,
%{name: file.name, url: file.url, id: id, content_type: file.content_type, size: file.size}}
else
case Media.get_picture(picture_id) do
%Picture{id: id, file: file} = _pic ->
{:ok,
%{
name: file.name,
url: file.url,
id: id,
content_type: file.content_type,
size: file.size
}}
_err ->
{:error, "Picture with ID #{picture_id} was not found"}
end