Hi, I’m trying to make an api for getting users by user_type.
I made getting users api with :index
and getting a specific user api using user_id with :show.
But one day, one of our team wants to make an api to find a specific user with
user_type.
So I made it like this
def index(conn, %{"type" => type}) do
with users when not is_nil(user) <- UserContext.get_user(type) do
render(conn, "index.json", %{user: user})
end
end
But is it okay to use like getting only one user in the index action?
I used the resources for the three apis.
Thanks for reading my question.