Add a function to lookup client app details by the app_id
This commit is contained in:
parent
fc42e714e2
commit
de8b8e9cf1
|
@ -146,4 +146,14 @@ def errors(changeset) do
|
|||
Map.put(acc, key, error)
|
||||
end)
|
||||
end
|
||||
|
||||
@spec get_app_by_id(pos_integer()) :: {:ok, map()}
|
||||
def get_app_by_id(app_id) do
|
||||
query =
|
||||
__MODULE__
|
||||
|> where([a], a.id == ^app_id)
|
||||
|> select([a], %{name: a.client_name, website: a.website})
|
||||
|
||||
Repo.one!(query)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue