mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-25 04:47:59 +01:00
723bfa213f
* AwardJson, LinkJson, UserJson to views * FilterJson -> view * ForumJson -> view * TopicJson -> view * PostJson -> view * TagJson -> view * CommentJson -> view * GalleryJson -> view
25 lines
513 B
Elixir
Executable file
25 lines
513 B
Elixir
Executable file
defmodule PhilomenaWeb.Api.Json.ProfileController do
|
|
use PhilomenaWeb, :controller
|
|
|
|
alias Philomena.Users.User
|
|
alias Philomena.Repo
|
|
import Ecto.Query
|
|
|
|
def show(conn, %{"id" => id}) do
|
|
user =
|
|
User
|
|
|> where(id: ^id)
|
|
|> preload(public_links: :tag, awards: :badge)
|
|
|> Repo.one()
|
|
|
|
cond do
|
|
is_nil(user) or user.deleted_at ->
|
|
conn
|
|
|> put_status(:not_found)
|
|
|> text("")
|
|
|
|
true ->
|
|
render(conn, "show.json", user: user)
|
|
end
|
|
end
|
|
end
|