Skip to content

Commit

Permalink
feat: add is_admin field to staff view
Browse files Browse the repository at this point in the history
  • Loading branch information
ruilopesm committed Feb 2, 2024
1 parent 3896ffa commit 06eb2e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/safira_web/controllers/auth_json.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ defmodule SafiraWeb.AuthJSON do
|> Map.merge(CompanyView.render("company.json", company: company))
end

def data(%{user: %{type: "staff"}} = user) do
def data(%{user: %{type: "staff", staff: staff}} = user) do
user_data(user)
|> Map.merge(%{is_admin: staff.is_admin})
end

defp user_data(%{user: user}) do
Expand Down

0 comments on commit 06eb2e5

Please sign in to comment.