Commit 4e21d948 authored by Peter van der meulen's avatar Peter van der meulen

Show more info on failure

parent 49df6ed4
...@@ -98,7 +98,7 @@ defmodule SnugglesApp.Accounts do ...@@ -98,7 +98,7 @@ defmodule SnugglesApp.Accounts do
discord_id: Integer.to_string(author_id) discord_id: Integer.to_string(author_id)
}) })
SnugglesApp.RabbitService.publish_json("account.events", %{"user_id" => user.id}) SnugglesApp.RabbitService.publish_json("account.events", %{"user_id" => user.id, "discord_id" => author_id})
end end
end end
...@@ -114,7 +114,7 @@ defmodule SnugglesApp.Accounts do ...@@ -114,7 +114,7 @@ defmodule SnugglesApp.Accounts do
{:error, %Ecto.Changeset{}} {:error, %Ecto.Changeset{}}
""" """
def handle_user_update_request(%{"user_id" => user_id}) do def handle_user_update_request(%{"user_id" => user_id} = _) do
user = Repo.get(User, user_id) user = Repo.get(User, user_id)
{:ok, eve_user} = EveUser.fetch_full(user.character_id) {:ok, eve_user} = EveUser.fetch_full(user.character_id)
{:ok, updated_user} = update_user(user, eve_user) {:ok, updated_user} = update_user(user, eve_user)
...@@ -192,7 +192,7 @@ defmodule SnugglesApp.Accounts do ...@@ -192,7 +192,7 @@ defmodule SnugglesApp.Accounts do
user -> user ->
update_user(user, %{access: 0}) update_user(user, %{access: 0})
SnugglesApp.RabbitService.publish_json("account.events", %{"user_id" => user.id}) SnugglesApp.RabbitService.publish_json("account.events", %{"user_id" => user.id, "discord_id" => user.discord_id})
Discord.send_message_to_admin("User <@#{user.discord_id}>: scheduled to update") Discord.send_message_to_admin("User <@#{user.discord_id}>: scheduled to update")
end end
end end
......
...@@ -85,7 +85,7 @@ defmodule SnugglesApp.RabbitService.AccountConsumer do ...@@ -85,7 +85,7 @@ defmodule SnugglesApp.RabbitService.AccountConsumer do
{:ok, %{"level" => "admin"} = object} -> {:ok, %{"level" => "admin"} = object} ->
SnugglesApp.Accounts.handle_admin_request(object) SnugglesApp.Accounts.handle_admin_request(object)
:ok = Basic.ack channel, tag :ok = Basic.ack channel, tag
{:ok, object = %{"user_id" => _}} -> {:ok, %{"user_id" => _} = object} ->
SnugglesApp.Accounts.handle_user_update_request(object) SnugglesApp.Accounts.handle_user_update_request(object)
:ok = Basic.ack channel, tag :ok = Basic.ack channel, tag
{:ok, %{"guild_id" => _, "role_id" => _} = object} -> {:ok, %{"guild_id" => _, "role_id" => _} = object} ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment