From d78da37d3fbeac4c485abd621e6d4a0b6dd38a7b Mon Sep 17 00:00:00 2001 From: snewcomer24 Date: Mon, 13 Nov 2017 07:39:50 -0800 Subject: [PATCH 1/6] Replace TaskList with jsonapi --- config/config.exs | 3 + .../controllers/task_list_controller.ex | 5 +- lib/code_corps_web/views/comment_view.ex | 1 + lib/code_corps_web/views/project_view.ex | 9 ++ lib/code_corps_web/views/task_list_view.ex | 18 ++- lib/code_corps_web/views/task_view.ex | 60 ++++---- mix.exs | 1 + mix.lock | 139 +++++++++--------- .../views/task_list_view_test.exs | 2 +- 9 files changed, 132 insertions(+), 106 deletions(-) diff --git a/config/config.exs b/config/config.exs index aa6063423..aa4f87324 100644 --- a/config/config.exs +++ b/config/config.exs @@ -87,6 +87,9 @@ config :code_corps, :processor, CodeCorps.Processor.Async config :code_corps, password_reset_timeout: 3600 +config :jsonapi, + remove_links: true + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{Mix.env}.exs" diff --git a/lib/code_corps_web/controllers/task_list_controller.ex b/lib/code_corps_web/controllers/task_list_controller.ex index 6fa9682b9..e8444e4f0 100644 --- a/lib/code_corps_web/controllers/task_list_controller.ex +++ b/lib/code_corps_web/controllers/task_list_controller.ex @@ -3,6 +3,7 @@ defmodule CodeCorpsWeb.TaskListController do use CodeCorpsWeb, :controller alias CodeCorps.{Helpers.Query, TaskList} + alias CodeCorpsWeb.{TaskListView} action_fallback CodeCorpsWeb.FallbackController plug CodeCorpsWeb.Plug.DataToAttributes @@ -18,13 +19,13 @@ defmodule CodeCorpsWeb.TaskListController do |> Repo.all() |> preload() - conn |> render("index.json-api", data: task_lists) + conn |> render(TaskListView, "index.json-api", %{data: task_lists, conn: conn}) end @spec show(Conn.t, map) :: Conn.t def show(%Conn{} = conn, %{"id" => id}) do with %TaskList{} = task_list <- TaskList |> Repo.get(id) |> preload() do - conn |> render("show.json-api", data: task_list) + conn |> render(TaskListView, "show.json-api", %{data: task_list, conn: conn, params: id}) end end diff --git a/lib/code_corps_web/views/comment_view.ex b/lib/code_corps_web/views/comment_view.ex index 10c703959..add4589e6 100644 --- a/lib/code_corps_web/views/comment_view.ex +++ b/lib/code_corps_web/views/comment_view.ex @@ -2,6 +2,7 @@ defmodule CodeCorpsWeb.CommentView do @moduledoc false use CodeCorpsWeb, :view use JaSerializer.PhoenixView + use JSONAPI.View, type: "comment" attributes [ :body, :created_at, :created_from, :inserted_at, :markdown, :modified_at, diff --git a/lib/code_corps_web/views/project_view.ex b/lib/code_corps_web/views/project_view.ex index 57087b3ad..5fa2431c1 100644 --- a/lib/code_corps_web/views/project_view.ex +++ b/lib/code_corps_web/views/project_view.ex @@ -5,6 +5,15 @@ defmodule CodeCorpsWeb.ProjectView do use CodeCorpsWeb, :view use JaSerializer.PhoenixView + use JSONAPI.View, type: "project" + + def fields do + [:approved, :can_activate_donations, :cloudinary_public_id, + :description, :donations_active, :icon_thumb_url, + :icon_large_url, :inserted_at, :long_description_body, + :long_description_markdown, :should_link_externally, :slug, :title, + :total_monthly_donated, :updated_at, :website] + end attributes [ :approval_requested, diff --git a/lib/code_corps_web/views/task_list_view.ex b/lib/code_corps_web/views/task_list_view.ex index a6ccad2e4..7747195a6 100644 --- a/lib/code_corps_web/views/task_list_view.ex +++ b/lib/code_corps_web/views/task_list_view.ex @@ -1,11 +1,21 @@ defmodule CodeCorpsWeb.TaskListView do @moduledoc false use CodeCorpsWeb, :view - use JaSerializer.PhoenixView + use JSONAPI.View, type: "task-list" - attributes [:done, :inbox, :name, :order, :pull_requests, :inserted_at, :updated_at] + alias CodeCorpsWeb.{ProjectView, TaskView} - has_one :project, type: "project", field: :project_id + def render("index.json-api", %{data: task_list, conn: conn}) do + __MODULE__.index(task_list, conn, nil) + end - has_many :tasks, serializer: CodeCorpsWeb.TaskView, identifiers: :always + def render("show.json-api", %{data: task_list, conn: conn, params: params}) do + __MODULE__.show(task_list, conn, params) + end + + def fields, do: [:done, :inbox, :name, :order, :pull_requests, :inserted_at, :updated_at] + + def relationships do + [project: ProjectView, tasks: TaskView] + end end diff --git a/lib/code_corps_web/views/task_view.ex b/lib/code_corps_web/views/task_view.ex index 9f0ee1c9e..1321e0697 100644 --- a/lib/code_corps_web/views/task_view.ex +++ b/lib/code_corps_web/views/task_view.ex @@ -1,39 +1,39 @@ defmodule CodeCorpsWeb.TaskView do @moduledoc false use CodeCorpsWeb, :view - use JaSerializer.PhoenixView + use JSONAPI.View, type: "task" - attributes [ - :archived, :body, :created_at, :created_from, :has_github_pull_request, - :inserted_at, :markdown, :modified_at, :modified_from, :number, :order, - :overall_status, :status, :title, :updated_at - ] + alias CodeCorpsWeb.{GithubIssueView, GithubPullRequestView, GithubRepoView, ProjectView, + TaskListView, UserView, UserTaskView, CommentView, TaskSkillView} - has_one :github_issue, type: "github-issue", field: :github_issue_id - has_one :github_pull_request, serializer: CodeCorpsWeb.GithubPullRequestView, identifiers: :always - has_one :github_repo, type: "github-repo", field: :github_repo_id - has_one :project, type: "project", field: :project_id - has_one :task_list, type: "task-list", field: :task_list_id - has_one :user, type: "user", field: :user_id - has_one :user_task, serializer: CodeCorpsWeb.UserTaskView, identifiers: :always + def fields do + [:archived, :body, :created_at, :created_from, :inserted_at, :markdown, + :modified_at, :modified_from, :number, :order, :status, :title, :updated_at] + end - has_many :comments, serializer: CodeCorpsWeb.CommentView, identifiers: :always - has_many :task_skills, serializer: CodeCorpsWeb.TaskSkillView, identifiers: :always + def relationships do + [comments: CommentView, task_skills: TaskSkillView] + end - def has_github_pull_request(%{ - github_pull_request: %CodeCorps.GithubPullRequest{} - }), do: true - def has_github_pull_request(%{github_pull_request: nil}), do: false +# <<<<<<< HEAD +# has_many :comments, serializer: CodeCorpsWeb.CommentView, identifiers: :always +# has_many :task_skills, serializer: CodeCorpsWeb.TaskSkillView, identifiers: :always - def overall_status(%{ - github_pull_request: %CodeCorps.GithubPullRequest{merged: merged, state: state} - }, _conn) do - case merged do - true -> "merged" - false -> state - end - end - def overall_status(%{github_pull_request: nil, status: status}, _conn) do - status - end +# def has_github_pull_request(%{ +# github_pull_request: %CodeCorps.GithubPullRequest{} +# }), do: true +# def has_github_pull_request(%{github_pull_request: nil}), do: false + +# def overall_status(%{ +# github_pull_request: %CodeCorps.GithubPullRequest{merged: merged, state: state} +# }, _conn) do +# case merged do +# true -> "merged" +# false -> state +# end +# end +# def overall_status(%{github_pull_request: nil, status: status}, _conn) do +# status +# end +# ======= end diff --git a/mix.exs b/mix.exs index b5b4a2855..3d3f4c97a 100644 --- a/mix.exs +++ b/mix.exs @@ -72,6 +72,7 @@ defmodule CodeCorps.Mixfile do {:ja_serializer, "~> 0.12"}, # JSON API {:joken, "~> 1.5"}, # JWT encoding {:mix_test_watch, "~> 0.5", only: :dev, runtime: false}, + {:jsonapi, git: "https://github.com/jeregrine/jsonapi.git"}, {:money, "~> 1.2.1"}, {:poison, "~> 3.0", override: true}, {:scout_apm, "~> 0.0"}, diff --git a/mix.lock b/mix.lock index 9047047d8..68dbc70dd 100644 --- a/mix.lock +++ b/mix.lock @@ -1,72 +1,73 @@ -%{"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], []}, - "bamboo": {:hex, :bamboo, "0.8.0", "573889a3efcb906bb9d25a1c4caa4ca22f479235e1b8cc3260d8b88dabeb4b14", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, optional: false]}]}, - "bamboo_postmark": {:hex, :bamboo_postmark, "0.4.1", "2ec8fad4d221944f5169ea4346e6e1aef3578282c352c9f7184306d872aa1c26", [:mix], [{:bamboo, "~> 0.5", [hex: :bamboo, optional: false]}, {:hackney, "~> 1.6", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, optional: false]}]}, - "base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [], []}, - "benchfella": {:hex, :benchfella, "0.3.5", "b2122c234117b3f91ed7b43b6e915e19e1ab216971154acd0a80ce0e9b8c05f5", [:mix], []}, - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []}, - "bypass": {:hex, :bypass, "0.8.1", "16d409e05530ece4a72fabcf021a3e5c7e15dcc77f911423196a0c551f2a15ca", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}]}, - "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []}, +%{"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], [], "hexpm"}, + "bamboo": {:hex, :bamboo, "0.8.0", "573889a3efcb906bb9d25a1c4caa4ca22f479235e1b8cc3260d8b88dabeb4b14", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "bamboo_postmark": {:hex, :bamboo_postmark, "0.4.1", "2ec8fad4d221944f5169ea4346e6e1aef3578282c352c9f7184306d872aa1c26", [:mix], [{:bamboo, "~> 0.5", [hex: :bamboo, repo: "hexpm", optional: false]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"}, + "benchfella": {:hex, :benchfella, "0.3.5", "b2122c234117b3f91ed7b43b6e915e19e1ab216971154acd0a80ce0e9b8c05f5", [:mix], [], "hexpm"}, + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, + "bypass": {:hex, :bypass, "0.8.1", "16d409e05530ece4a72fabcf021a3e5c7e15dcc77f911423196a0c551f2a15ca", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, + "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"}, "cloudex": {:hex, :cloudex, "1.0.1", "51ae96126ef17abb732692ef7bbd8a9c5b26fc01c4a893c42baa219ff9ac562c", [:mix], [{:httpoison, "~> 0.13.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, "~> 3.1.0", [hex: :poison, repo: "hexpm", optional: false]}, {:timex, "~> 3.1.7", [hex: :timex, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.5.11", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"}, - "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], []}, - "comeonin": {:hex, :comeonin, "3.2.0", "cb10995a22aed6812667efb3856f548818c85d85394d8132bc116fbd6995c1ef", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, optional: false]}]}, - "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [], []}, - "corsica": {:hex, :corsica, "1.0.0", "e11d39e72c9907c96650d1a5b5586e9f333643a17d0120380ad1d7dacdc9eb43", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}]}, - "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]}, - "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [], []}, - "credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]}, - "db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, optional: true]}]}, - "decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], []}, - "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], []}, - "earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], []}, - "ecto": {:hex, :ecto, "2.2.6", "3fd1067661d6d64851a0d4db9acd9e884c00d2d1aa41cc09da687226cf894661", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, optional: true]}]}, - "ecto_ordered": {:hex, :ecto_ordered, "0.2.0-beta1", "cb066bc608f1c8913cea85af8293261720e6a88e3c99061e6877d7025352f045", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, optional: false]}]}, - "elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [:mix], []}, - "ex_aws": {:hex, :ex_aws, "1.1.4", "4bdc4fff91f8d35c7fe2355b9da54cc51f980c92f1137715d8b2d70d8e8511cc", [:mix], [{:configparser_ex, "~> 0.2.1", [hex: :configparser_ex, optional: true]}, {:hackney, "1.6.3 or 1.6.5 or 1.7.1 or 1.8.6 or ~> 1.9", [hex: :hackney, optional: true]}, {:jsx, "~> 2.8", [hex: :jsx, optional: true]}, {:poison, ">= 1.2.0", [hex: :poison, optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, optional: true]}, {:xml_builder, "~> 0.1.0", [hex: :xml_builder, optional: true]}]}, - "ex_doc": {:hex, :ex_doc, "0.18.1", "37c69d2ef62f24928c1f4fdc7c724ea04aecfdf500c4329185f8e3649c915baf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]}, - "ex_machina": {:hex, :ex_machina, "2.1.0", "4874dc9c78e7cf2d429f24dc3c4005674d4e4da6a08be961ffccc08fb528e28b", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, optional: true]}]}, - "excoveralls": {:hex, :excoveralls, "0.7.5", "339e433e5d3bce09400dc8de7b9040741a409c93917849916c136a0f51fdc183", [:mix], [{:exjsx, ">= 3.0.0", [hex: :exjsx, optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, optional: false]}]}, - "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, optional: false]}]}, - "file_system": {:hex, :file_system, "0.2.2", "7f1e9de4746f4eb8a4ca8f2fbab582d84a4e40fa394cce7bfcb068b988625b06", [:mix], []}, - "fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], []}, - "gettext": {:hex, :gettext, "0.13.1", "5e0daf4e7636d771c4c71ad5f3f53ba09a9ae5c250e1ab9c42ba9edccc476263", [:mix], []}, - "guardian": {:hex, :guardian, "1.0.0", "21bae2a8c0b4ed5943d9da0c6aeb16e52874c1f675de5d7920ae35471c6263f9", [:mix], [{:jose, "~> 1.8", [hex: :jose, optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, optional: true]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: false]}, {:uuid, ">= 1.1.1", [hex: :uuid, optional: false]}]}, - "hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, optional: false]}, {:idna, "5.1.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]}, - "httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, optional: false]}]}, - "idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, optional: false]}]}, - "inch_ex": {:hex, :inch_ex, "0.5.6", "418357418a553baa6d04eccd1b44171936817db61f4c0840112b420b8e378e67", [:mix], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}]}, - "inflex": {:hex, :inflex, "1.9.0", "2bef01a84437bca0a12fc107821ae7771b0ba847dccab5d1cd61f35972e66813", [:mix], []}, - "ja_serializer": {:hex, :ja_serializer, "0.12.0", "ba4ec5fc7afa6daba815b5cb2b9bd0de410554ac4f0ed54e954d39decb353ca4", [:mix], [{:inflex, "~> 1.4", [hex: :inflex, optional: false]}, {:plug, "> 1.0.0", [hex: :plug, optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, optional: false]}, {:scrivener, "~> 1.2 or ~> 2.0", [hex: :scrivener, optional: true]}]}, - "joken": {:hex, :joken, "1.5.0", "42a0953e80bd933fc98a0874e156771f78bf0e92abe6c3a9c22feb6da28efb0b", [:mix], [{:jose, "~> 1.8", [hex: :jose, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: true]}]}, - "jose": {:hex, :jose, "1.8.4", "7946d1e5c03a76ac9ef42a6e6a20001d35987afd68c2107bcd8f01a84e75aa73", [:mix, :rebar3], [{:base64url, "~> 0.0.1", [hex: :base64url, optional: false]}]}, - "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], []}, - "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [], []}, - "mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], []}, - "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [], []}, + "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm"}, + "comeonin": {:hex, :comeonin, "3.2.0", "cb10995a22aed6812667efb3856f548818c85d85394d8132bc116fbd6995c1ef", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, + "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"}, + "corsica": {:hex, :corsica, "1.1.0", "e5e2960dd8883d7876285acb0f4cfe65a5f5d9d5794f0b4748e2930ad2673fe8", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, + "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"}, + "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"}, + "credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"}, + "db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, + "decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], [], "hexpm"}, + "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, + "earmark": {:hex, :earmark, "1.2.4", "99b637c62a4d65a20a9fb674b8cffb8baa771c04605a80c911c4418c69b75439", [:mix], [], "hexpm"}, + "ecto": {:hex, :ecto, "2.2.7", "2074106ff4a5cd9cb2b54b12ca087c4b659ddb3f6b50be4562883c1d763fb031", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, + "ecto_ordered": {:hex, :ecto_ordered, "0.2.0-beta1", "cb066bc608f1c8913cea85af8293261720e6a88e3c99061e6877d7025352f045", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm"}, + "elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [:mix], [], "hexpm"}, + "ex_aws": {:hex, :ex_aws, "1.1.5", "789173f385934f7e27f9ef36692a6c5f7dde06fd6e6f64d4cd92cda613d34bf9", [:mix], [{:configparser_ex, "~> 0.2.1", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "1.6.3 or 1.6.5 or 1.7.1 or 1.8.6 or ~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optional: true]}, {:poison, ">= 1.2.0", [hex: :poison, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:xml_builder, "~> 0.1.0", [hex: :xml_builder, repo: "hexpm", optional: true]}], "hexpm"}, + "ex_doc": {:hex, :ex_doc, "0.18.1", "37c69d2ef62f24928c1f4fdc7c724ea04aecfdf500c4329185f8e3649c915baf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, + "ex_machina": {:hex, :ex_machina, "2.1.0", "4874dc9c78e7cf2d429f24dc3c4005674d4e4da6a08be961ffccc08fb528e28b", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"}, + "excoveralls": {:hex, :excoveralls, "0.7.5", "339e433e5d3bce09400dc8de7b9040741a409c93917849916c136a0f51fdc183", [:mix], [{:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, + "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"}, + "file_system": {:hex, :file_system, "0.2.2", "7f1e9de4746f4eb8a4ca8f2fbab582d84a4e40fa394cce7bfcb068b988625b06", [:mix], [], "hexpm"}, + "fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], [], "hexpm"}, + "gettext": {:hex, :gettext, "0.14.0", "1a019a2e51d5ad3d126efe166dcdf6563768e5d06c32a99ad2281a1fa94b4c72", [:mix], [], "hexpm"}, + "guardian": {:hex, :guardian, "1.0.0", "21bae2a8c0b4ed5943d9da0c6aeb16e52874c1f675de5d7920ae35471c6263f9", [:mix], [{:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}, {:uuid, ">= 1.1.1", [hex: :uuid, repo: "hexpm", optional: false]}], "hexpm"}, + "hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, + "httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, + "idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, + "inch_ex": {:hex, :inch_ex, "0.5.6", "418357418a553baa6d04eccd1b44171936817db61f4c0840112b420b8e378e67", [:mix], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "inflex": {:hex, :inflex, "1.9.0", "2bef01a84437bca0a12fc107821ae7771b0ba847dccab5d1cd61f35972e66813", [:mix], [], "hexpm"}, + "ja_serializer": {:hex, :ja_serializer, "0.12.0", "ba4ec5fc7afa6daba815b5cb2b9bd0de410554ac4f0ed54e954d39decb353ca4", [:mix], [{:inflex, "~> 1.4", [hex: :inflex, repo: "hexpm", optional: false]}, {:plug, "> 1.0.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:scrivener, "~> 1.2 or ~> 2.0", [hex: :scrivener, repo: "hexpm", optional: true]}], "hexpm"}, + "joken": {:hex, :joken, "1.5.0", "42a0953e80bd933fc98a0874e156771f78bf0e92abe6c3a9c22feb6da28efb0b", [:mix], [{:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"}, + "jose": {:hex, :jose, "1.8.4", "7946d1e5c03a76ac9ef42a6e6a20001d35987afd68c2107bcd8f01a84e75aa73", [:mix, :rebar3], [{:base64url, "~> 0.0.1", [hex: :base64url, repo: "hexpm", optional: false]}], "hexpm"}, + "jsonapi": {:git, "https://github.com/jeregrine/jsonapi.git", "6b0b24c7f7beb4a9ed17ae33c91866546ccdb420", []}, + "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, + "mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], [], "hexpm"}, + "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"}, "mix_test_watch": {:hex, :mix_test_watch, "0.5.0", "2c322d119a4795c3431380fca2bca5afa4dc07324bd3c0b9f6b2efbdd99f5ed3", [:mix], [{:fs, "~> 0.9.1", [hex: :fs, repo: "hexpm", optional: false]}], "hexpm"}, - "money": {:hex, :money, "1.2.1", "fdcc7b021b894dbcc2cd0f57d2ccdd2224eced747231337a849424ffaa196b13", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 2.1", [hex: :ecto, optional: true]}, {:phoenix_html, "~> 2.0", [hex: :phoenix_html, optional: true]}]}, - "msgpax": {:hex, :msgpax, "1.1.0", "e31625e256db2decca1ae2b841f21b4d2483b1332649ce3ebc96c7ff7a4986e3", [:mix], [{:plug, "~> 1.0", [hex: :plug, optional: true]}]}, - "phoenix": {:hex, :phoenix, "1.3.0", "1c01124caa1b4a7af46f2050ff11b267baa3edb441b45dbf243e979cd4c5891b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: false]}]}, - "phoenix_ecto": {:hex, :phoenix_ecto, "3.3.0", "702f6e164512853d29f9d20763493f2b3bcfcb44f118af2bc37bb95d0801b480", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, optional: true]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}]}, - "phoenix_html": {:hex, :phoenix_html, "2.10.5", "4f9df6b0fb7422a9440a73182a566cb9cbe0e3ffe8884ef9337ccf284fc1ef0a", [:mix], [{:plug, "~> 1.0", [hex: :plug, optional: false]}]}, - "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.1.3", "1d178429fc8950b12457d09c6afec247bfe1fcb6f36209e18fbb0221bdfe4d41", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, optional: false]}]}, - "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], []}, - "plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]}, - "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []}, - "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [], []}, - "postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}]}, - "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], []}, - "scout_apm": {:hex, :scout_apm, "0.3.3", "8679378b624b502d7f6e8a1b023b57f4c7ab717380291e2b40ccdb2923457194", [:mix], [{:approximate_histogram, "~>0.1.1", [hex: :approximate_histogram, optional: false]}, {:hackney, "~> 1.0", [hex: :hackney, optional: false]}, {:plug, "~>1.0", [hex: :plug, optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, optional: false]}]}, - "scrivener": {:hex, :scrivener, "2.4.0", "c9431804b13ac6a5c4b01eb32188c1ff926898a2d684244d021706841f022e66", [:mix], []}, - "scrivener_ecto": {:hex, :scrivener_ecto, "1.3.0", "69698428e22810ac8a47abc12d1df5b2f5d8f6b36dc5d5bfe6dd93fde857c576", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, optional: false]}, {:postgrex, "~> 0.11.0 or ~> 0.12.0 or ~> 0.13.0", [hex: :postgrex, optional: true]}, {:scrivener, "~> 2.4", [hex: :scrivener, optional: false]}]}, - "segment": {:hex, :segment, "0.1.1", "47bf9191590e7a533c105d1e21518e0d6da47c91e8d98ebb649c624db5dfc359", [:mix], [{:httpoison, "~> 0.8", [hex: :httpoison, optional: false]}, {:poison, "~> 1.3 or ~> 2.0", [hex: :poison, optional: false]}]}, - "sentry": {:hex, :sentry, "6.0.4", "b7f93e77cdc2a44a55ec2bec886c3eeab7d562316fecd3000c04b68d1a6b0392", [:mix], [{:hackney, "~> 1.8 or 1.6.5", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}, {:uuid, "~> 1.0", [hex: :uuid, optional: false]}]}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []}, + "money": {:hex, :money, "1.2.1", "fdcc7b021b894dbcc2cd0f57d2ccdd2224eced747231337a849424ffaa196b13", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 2.1", [hex: :ecto, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm"}, + "msgpax": {:hex, :msgpax, "1.1.0", "e31625e256db2decca1ae2b841f21b4d2483b1332649ce3ebc96c7ff7a4986e3", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm"}, + "phoenix": {:hex, :phoenix, "1.3.0", "1c01124caa1b4a7af46f2050ff11b267baa3edb441b45dbf243e979cd4c5891b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_ecto": {:hex, :phoenix_ecto, "3.3.0", "702f6e164512853d29f9d20763493f2b3bcfcb44f118af2bc37bb95d0801b480", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_html": {:hex, :phoenix_html, "2.10.5", "4f9df6b0fb7422a9440a73182a566cb9cbe0e3ffe8884ef9337ccf284fc1ef0a", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.1.3", "1d178429fc8950b12457d09c6afec247bfe1fcb6f36209e18fbb0221bdfe4d41", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], [], "hexpm"}, + "plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, + "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, + "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], [], "hexpm"}, + "postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"}, + "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm"}, + "scout_apm": {:hex, :scout_apm, "0.3.3", "8679378b624b502d7f6e8a1b023b57f4c7ab717380291e2b40ccdb2923457194", [:mix], [{:approximate_histogram, "~>0.1.1", [hex: :approximate_histogram, repo: "hexpm", optional: false]}, {:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~>1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "scrivener": {:hex, :scrivener, "2.4.0", "c9431804b13ac6a5c4b01eb32188c1ff926898a2d684244d021706841f022e66", [:mix], [], "hexpm"}, + "scrivener_ecto": {:hex, :scrivener_ecto, "1.3.0", "69698428e22810ac8a47abc12d1df5b2f5d8f6b36dc5d5bfe6dd93fde857c576", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.11.0 or ~> 0.12.0 or ~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:scrivener, "~> 2.4", [hex: :scrivener, repo: "hexpm", optional: false]}], "hexpm"}, + "segment": {:hex, :segment, "0.1.1", "47bf9191590e7a533c105d1e21518e0d6da47c91e8d98ebb649c624db5dfc359", [:mix], [{:httpoison, "~> 0.8", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, "~> 1.3 or ~> 2.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "sentry": {:hex, :sentry, "6.0.5", "5f4e5818e39b2721bb92ee07c164d10c510af9b519dc587727008433e119ad7a", [:mix], [{:hackney, "~> 1.8 or 1.6.5", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}, {:uuid, "~> 1.0", [hex: :uuid, repo: "hexpm", optional: false]}], "hexpm"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"}, "stripity_stripe": {:git, "https://github.com/code-corps/stripity_stripe.git", "1493e42eb5bd39b135a6686912a20ce200d07375", [branch: "2.0-beta"]}, - "sweet_xml": {:hex, :sweet_xml, "0.6.5", "dd9cde443212b505d1b5f9758feb2000e66a14d3c449f04c572f3048c66e6697", [:mix], []}, - "timber": {:hex, :timber, "2.6.1", "946dee43730b30748c7a3ed0085abe8690dcbaf4cd96031caba676b938dd40a6", [:mix], [{:ecto, ">= 2.0.0 and < 2.3.0", [hex: :ecto, optional: true]}, {:hackney, "1.6.3 or 1.6.5 or 1.7.1 or 1.8.6 or ~> 1.9", [hex: :hackney, optional: false]}, {:msgpax, "~> 1.0", [hex: :msgpax, optional: false]}, {:phoenix, ">= 1.2.0 and < 1.4.0", [hex: :phoenix, optional: true]}, {:plug, ">= 1.2.0 and < 1.5.0", [hex: :plug, optional: true]}, {:poison, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}]}, - "timex": {:hex, :timex, "3.1.24", "d198ae9783ac807721cca0c5535384ebdf99da4976be8cefb9665a9262a1e9e3", [:mix], [{:combine, "~> 0.7", [hex: :combine, optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, optional: false]}]}, - "timex_ecto": {:hex, :timex_ecto, "3.2.1", "461140751026e1ca03298fab628f78ab189e78784175f5e301eefa034ee530aa", [:mix], [{:ecto, "~> 2.2", [hex: :ecto, optional: false]}, {:timex, "~> 3.1", [hex: :timex, optional: false]}]}, - "tzdata": {:hex, :tzdata, "0.5.14", "56f05ea3dd87db946966ab3c7168c0b35025c7ee0e9b4fc130a04631f5611eb1", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, optional: false]}]}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], []}, - "uri_query": {:hex, :uri_query, "0.1.2", "ae35b83b472f3568c2c159eee3f3ccf585375d8a94fb5382db1ea3589e75c3b4", [:mix], []}, - "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], []}} + "sweet_xml": {:hex, :sweet_xml, "0.6.5", "dd9cde443212b505d1b5f9758feb2000e66a14d3c449f04c572f3048c66e6697", [:mix], [], "hexpm"}, + "timber": {:hex, :timber, "2.6.1", "946dee43730b30748c7a3ed0085abe8690dcbaf4cd96031caba676b938dd40a6", [:mix], [{:ecto, ">= 2.0.0 and < 2.3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:hackney, "1.6.3 or 1.6.5 or 1.7.1 or 1.8.6 or ~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:msgpax, "~> 1.0", [hex: :msgpax, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.2.0 and < 1.4.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, ">= 1.2.0 and < 1.5.0", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "timex": {:hex, :timex, "3.1.24", "d198ae9783ac807721cca0c5535384ebdf99da4976be8cefb9665a9262a1e9e3", [:mix], [{:combine, "~> 0.7", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"}, + "timex_ecto": {:hex, :timex_ecto, "3.2.1", "461140751026e1ca03298fab628f78ab189e78784175f5e301eefa034ee530aa", [:mix], [{:ecto, "~> 2.2", [hex: :ecto, repo: "hexpm", optional: false]}, {:timex, "~> 3.1", [hex: :timex, repo: "hexpm", optional: false]}], "hexpm"}, + "tzdata": {:hex, :tzdata, "0.5.14", "56f05ea3dd87db946966ab3c7168c0b35025c7ee0e9b4fc130a04631f5611eb1", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"}, + "uri_query": {:hex, :uri_query, "0.1.2", "ae35b83b472f3568c2c159eee3f3ccf585375d8a94fb5382db1ea3589e75c3b4", [:mix], [], "hexpm"}, + "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm"}} diff --git a/test/lib/code_corps_web/views/task_list_view_test.exs b/test/lib/code_corps_web/views/task_list_view_test.exs index a0332d8f3..e9f2133c8 100644 --- a/test/lib/code_corps_web/views/task_list_view_test.exs +++ b/test/lib/code_corps_web/views/task_list_view_test.exs @@ -7,7 +7,7 @@ defmodule CodeCorpsWeb.TaskListViewTest do task = insert(:task, order: 1000, task_list: task_list) task_list = CodeCorpsWeb.TaskListController.preload(task_list) - rendered_json = render(CodeCorpsWeb.TaskListView, "show.json-api", data: task_list) + rendered_json = render(CodeCorpsWeb.TaskListView, "show.json-api", %{data: task_list, conn: %Plug.Conn{}, params: task_list.id}) expected_json = %{ "data" => %{ From fc7020121cd6dade93b5c573fb293f648e2af813 Mon Sep 17 00:00:00 2001 From: snewcomer24 Date: Tue, 12 Dec 2017 11:14:05 -0800 Subject: [PATCH 2/6] update view test...still having problem with dates --- config/config.exs | 3 ++- .../views/task_list_view_test.exs | 27 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/config/config.exs b/config/config.exs index aa4f87324..8435a65fb 100644 --- a/config/config.exs +++ b/config/config.exs @@ -88,7 +88,8 @@ config :code_corps, :processor, CodeCorps.Processor.Async config :code_corps, password_reset_timeout: 3600 config :jsonapi, - remove_links: true + remove_links: true, + underscore_to_dash: true # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. diff --git a/test/lib/code_corps_web/views/task_list_view_test.exs b/test/lib/code_corps_web/views/task_list_view_test.exs index e9f2133c8..d9dfb2466 100644 --- a/test/lib/code_corps_web/views/task_list_view_test.exs +++ b/test/lib/code_corps_web/views/task_list_view_test.exs @@ -10,8 +10,8 @@ defmodule CodeCorpsWeb.TaskListViewTest do rendered_json = render(CodeCorpsWeb.TaskListView, "show.json-api", %{data: task_list, conn: %Plug.Conn{}, params: task_list.id}) expected_json = %{ - "data" => %{ - "attributes" => %{ + :data => %{ + attributes: %{ "done" => task_list.done, "inbox" => task_list.inbox, "name" => task_list.name, @@ -20,26 +20,25 @@ defmodule CodeCorpsWeb.TaskListViewTest do "inserted-at" => task_list.inserted_at, "updated-at" => task_list.updated_at, }, - "id" => task_list.id |> Integer.to_string, - "relationships" => %{ + id: task_list.id |> Integer.to_string, + relationships: %{ "project" => %{ - "data" => %{ - "id" => task_list.project_id |> Integer.to_string, - "type" => "project" + :data => %{ + id: task_list.project_id |> Integer.to_string, + type: "project" } }, "tasks" => %{ - "data" => [%{ - "id" => task.id |> Integer.to_string, - "type" => "task" + :data => [%{ + id: task.id |> Integer.to_string, + type: "task" }] } }, - "type" => "task-list", + type: "task-list", }, - "jsonapi" => %{ - "version" => "1.0" - } + :included => [], + :links => %{} } assert rendered_json == expected_json From 245dcd7dd01c37977c9a8f530a1498f7085e95e8 Mon Sep 17 00:00:00 2001 From: snewcomer24 Date: Tue, 12 Dec 2017 11:31:42 -0800 Subject: [PATCH 3/6] update jsonapi version --- mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 3d3f4c97a..5e89c967e 100644 --- a/mix.exs +++ b/mix.exs @@ -72,7 +72,7 @@ defmodule CodeCorps.Mixfile do {:ja_serializer, "~> 0.12"}, # JSON API {:joken, "~> 1.5"}, # JWT encoding {:mix_test_watch, "~> 0.5", only: :dev, runtime: false}, - {:jsonapi, git: "https://github.com/jeregrine/jsonapi.git"}, + {:jsonapi, "~> 0.6"}, {:money, "~> 1.2.1"}, {:poison, "~> 3.0", override: true}, {:scout_apm, "~> 0.0"}, diff --git a/mix.lock b/mix.lock index 68dbc70dd..d81c59a65 100644 --- a/mix.lock +++ b/mix.lock @@ -38,7 +38,7 @@ "ja_serializer": {:hex, :ja_serializer, "0.12.0", "ba4ec5fc7afa6daba815b5cb2b9bd0de410554ac4f0ed54e954d39decb353ca4", [:mix], [{:inflex, "~> 1.4", [hex: :inflex, repo: "hexpm", optional: false]}, {:plug, "> 1.0.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:scrivener, "~> 1.2 or ~> 2.0", [hex: :scrivener, repo: "hexpm", optional: true]}], "hexpm"}, "joken": {:hex, :joken, "1.5.0", "42a0953e80bd933fc98a0874e156771f78bf0e92abe6c3a9c22feb6da28efb0b", [:mix], [{:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"}, "jose": {:hex, :jose, "1.8.4", "7946d1e5c03a76ac9ef42a6e6a20001d35987afd68c2107bcd8f01a84e75aa73", [:mix, :rebar3], [{:base64url, "~> 0.0.1", [hex: :base64url, repo: "hexpm", optional: false]}], "hexpm"}, - "jsonapi": {:git, "https://github.com/jeregrine/jsonapi.git", "6b0b24c7f7beb4a9ed17ae33c91866546ccdb420", []}, + "jsonapi": {:hex, :jsonapi, "0.6.0", "eb52caf7627902bb3a979a67a9b20dfc478fc6a2d45bec5368ebb253f62931a6", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, "mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], [], "hexpm"}, From bb6d1ebb7525eb1604169389ab286923ced34fc7 Mon Sep 17 00:00:00 2001 From: snewcomer24 Date: Tue, 12 Dec 2017 11:46:58 -0800 Subject: [PATCH 4/6] tryign to reset views --- lib/code_corps_web/views/comment_view.ex | 1 - lib/code_corps_web/views/project_view.ex | 9 --- lib/code_corps_web/views/task_list_view.ex | 6 +- lib/code_corps_web/views/task_view.ex | 62 +++++++++---------- .../views/task_list_view_test.exs | 1 + 5 files changed, 35 insertions(+), 44 deletions(-) diff --git a/lib/code_corps_web/views/comment_view.ex b/lib/code_corps_web/views/comment_view.ex index add4589e6..10c703959 100644 --- a/lib/code_corps_web/views/comment_view.ex +++ b/lib/code_corps_web/views/comment_view.ex @@ -2,7 +2,6 @@ defmodule CodeCorpsWeb.CommentView do @moduledoc false use CodeCorpsWeb, :view use JaSerializer.PhoenixView - use JSONAPI.View, type: "comment" attributes [ :body, :created_at, :created_from, :inserted_at, :markdown, :modified_at, diff --git a/lib/code_corps_web/views/project_view.ex b/lib/code_corps_web/views/project_view.ex index 5fa2431c1..57087b3ad 100644 --- a/lib/code_corps_web/views/project_view.ex +++ b/lib/code_corps_web/views/project_view.ex @@ -5,15 +5,6 @@ defmodule CodeCorpsWeb.ProjectView do use CodeCorpsWeb, :view use JaSerializer.PhoenixView - use JSONAPI.View, type: "project" - - def fields do - [:approved, :can_activate_donations, :cloudinary_public_id, - :description, :donations_active, :icon_thumb_url, - :icon_large_url, :inserted_at, :long_description_body, - :long_description_markdown, :should_link_externally, :slug, :title, - :total_monthly_donated, :updated_at, :website] - end attributes [ :approval_requested, diff --git a/lib/code_corps_web/views/task_list_view.ex b/lib/code_corps_web/views/task_list_view.ex index 7747195a6..36d170b82 100644 --- a/lib/code_corps_web/views/task_list_view.ex +++ b/lib/code_corps_web/views/task_list_view.ex @@ -15,7 +15,7 @@ defmodule CodeCorpsWeb.TaskListView do def fields, do: [:done, :inbox, :name, :order, :pull_requests, :inserted_at, :updated_at] - def relationships do - [project: ProjectView, tasks: TaskView] - end + # def relationships do + # [project: ProjectView, tasks: TaskView] + # end end diff --git a/lib/code_corps_web/views/task_view.ex b/lib/code_corps_web/views/task_view.ex index 1321e0697..cac488206 100644 --- a/lib/code_corps_web/views/task_view.ex +++ b/lib/code_corps_web/views/task_view.ex @@ -1,39 +1,39 @@ defmodule CodeCorpsWeb.TaskView do @moduledoc false use CodeCorpsWeb, :view - use JSONAPI.View, type: "task" + use JaSerializer.PhoenixView - alias CodeCorpsWeb.{GithubIssueView, GithubPullRequestView, GithubRepoView, ProjectView, - TaskListView, UserView, UserTaskView, CommentView, TaskSkillView} + attributes [ + :archived, :body, :created_at, :created_from, :has_github_pull_request, + :inserted_at, :markdown, :modified_at, :modified_from, :number, :order, + :overall_status, :status, :title, :updated_at + ] - def fields do - [:archived, :body, :created_at, :created_from, :inserted_at, :markdown, - :modified_at, :modified_from, :number, :order, :status, :title, :updated_at] - end - - def relationships do - [comments: CommentView, task_skills: TaskSkillView] - end + has_one :github_issue, type: "github-issue", field: :github_issue_id + has_one :github_pull_request, serializer: CodeCorpsWeb.GithubPullRequestView, identifiers: :always + has_one :github_repo, type: "github-repo", field: :github_repo_id + has_one :project, type: "project", field: :project_id + has_one :task_list, type: "task-list", field: :task_list_id + has_one :user, type: "user", field: :user_id + has_one :user_task, serializer: CodeCorpsWeb.UserTaskView, identifiers: :always -# <<<<<<< HEAD -# has_many :comments, serializer: CodeCorpsWeb.CommentView, identifiers: :always -# has_many :task_skills, serializer: CodeCorpsWeb.TaskSkillView, identifiers: :always + has_many :comments, serializer: CodeCorpsWeb.CommentView, identifiers: :always + has_many :task_skills, serializer: CodeCorpsWeb.TaskSkillView, identifiers: :always -# def has_github_pull_request(%{ -# github_pull_request: %CodeCorps.GithubPullRequest{} -# }), do: true -# def has_github_pull_request(%{github_pull_request: nil}), do: false + def has_github_pull_request(%{ + github_pull_request: %CodeCorps.GithubPullRequest{} + }), do: true + def has_github_pull_request(%{github_pull_request: nil}), do: false -# def overall_status(%{ -# github_pull_request: %CodeCorps.GithubPullRequest{merged: merged, state: state} -# }, _conn) do -# case merged do -# true -> "merged" -# false -> state -# end -# end -# def overall_status(%{github_pull_request: nil, status: status}, _conn) do -# status -# end -# ======= -end + def overall_status(%{ + github_pull_request: %CodeCorps.GithubPullRequest{merged: merged, state: state} + }, _conn) do + case merged do + true -> "merged" + false -> state + end + end + def overall_status(%{github_pull_request: nil, status: status}, _conn) do + status + end +end \ No newline at end of file diff --git a/test/lib/code_corps_web/views/task_list_view_test.exs b/test/lib/code_corps_web/views/task_list_view_test.exs index d9dfb2466..e6dbd10f3 100644 --- a/test/lib/code_corps_web/views/task_list_view_test.exs +++ b/test/lib/code_corps_web/views/task_list_view_test.exs @@ -1,6 +1,7 @@ defmodule CodeCorpsWeb.TaskListViewTest do use CodeCorpsWeb.ViewCase + @tag :wip test "renders all attributes and relationships properly" do project = insert(:project) task_list = insert(:task_list, order: 1000, project: project) From 12f6808afd0957d55013a9742054906b36af2463 Mon Sep 17 00:00:00 2001 From: snewcomer24 Date: Wed, 13 Dec 2017 10:23:31 -0800 Subject: [PATCH 5/6] update task list controller --- .../controllers/task_list_controller.ex | 4 ++-- lib/code_corps_web/views/task_list_view.ex | 14 +++----------- .../code_corps_web/views/task_list_view_test.exs | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/code_corps_web/controllers/task_list_controller.ex b/lib/code_corps_web/controllers/task_list_controller.ex index e8444e4f0..025147d6c 100644 --- a/lib/code_corps_web/controllers/task_list_controller.ex +++ b/lib/code_corps_web/controllers/task_list_controller.ex @@ -19,13 +19,13 @@ defmodule CodeCorpsWeb.TaskListController do |> Repo.all() |> preload() - conn |> render(TaskListView, "index.json-api", %{data: task_lists, conn: conn}) + conn |> render(TaskListView, "index.json", %{data: task_lists, conn: conn}) end @spec show(Conn.t, map) :: Conn.t def show(%Conn{} = conn, %{"id" => id}) do with %TaskList{} = task_list <- TaskList |> Repo.get(id) |> preload() do - conn |> render(TaskListView, "show.json-api", %{data: task_list, conn: conn, params: id}) + conn |> render(TaskListView, "show.json", %{data: task_list, conn: conn, params: id}) end end diff --git a/lib/code_corps_web/views/task_list_view.ex b/lib/code_corps_web/views/task_list_view.ex index 36d170b82..dd5348fdf 100644 --- a/lib/code_corps_web/views/task_list_view.ex +++ b/lib/code_corps_web/views/task_list_view.ex @@ -5,17 +5,9 @@ defmodule CodeCorpsWeb.TaskListView do alias CodeCorpsWeb.{ProjectView, TaskView} - def render("index.json-api", %{data: task_list, conn: conn}) do - __MODULE__.index(task_list, conn, nil) - end - - def render("show.json-api", %{data: task_list, conn: conn, params: params}) do - __MODULE__.show(task_list, conn, params) - end - def fields, do: [:done, :inbox, :name, :order, :pull_requests, :inserted_at, :updated_at] - # def relationships do - # [project: ProjectView, tasks: TaskView] - # end + def relationships do + [project: ProjectView, tasks: TaskView] + end end diff --git a/test/lib/code_corps_web/views/task_list_view_test.exs b/test/lib/code_corps_web/views/task_list_view_test.exs index e6dbd10f3..0f73e7fcc 100644 --- a/test/lib/code_corps_web/views/task_list_view_test.exs +++ b/test/lib/code_corps_web/views/task_list_view_test.exs @@ -8,7 +8,7 @@ defmodule CodeCorpsWeb.TaskListViewTest do task = insert(:task, order: 1000, task_list: task_list) task_list = CodeCorpsWeb.TaskListController.preload(task_list) - rendered_json = render(CodeCorpsWeb.TaskListView, "show.json-api", %{data: task_list, conn: %Plug.Conn{}, params: task_list.id}) + rendered_json = render(CodeCorpsWeb.TaskListView, "show.json", %{data: task_list, conn: %Plug.Conn{}, params: task_list.id}) expected_json = %{ :data => %{ From f1444dc2a5ec541b48455f00c013d4600e32a8aa Mon Sep 17 00:00:00 2001 From: snewcomer24 Date: Wed, 13 Dec 2017 12:23:57 -0800 Subject: [PATCH 6/6] included with project and task --- .../views/project_jsonapi_view.ex | 43 ++++++++++++++++++ lib/code_corps_web/views/project_view.ex | 2 - lib/code_corps_web/views/task_jsonapi_view.ex | 43 ++++++++++++++++++ lib/code_corps_web/views/task_list_view.ex | 4 +- .../views/project_view_test.exs | 18 -------- .../views/task_list_view_test.exs | 44 ++++++++++++++++++- 6 files changed, 130 insertions(+), 24 deletions(-) create mode 100644 lib/code_corps_web/views/project_jsonapi_view.ex create mode 100644 lib/code_corps_web/views/task_jsonapi_view.ex diff --git a/lib/code_corps_web/views/project_jsonapi_view.ex b/lib/code_corps_web/views/project_jsonapi_view.ex new file mode 100644 index 000000000..c23c4ec1f --- /dev/null +++ b/lib/code_corps_web/views/project_jsonapi_view.ex @@ -0,0 +1,43 @@ +defmodule CodeCorpsWeb.ProjectJsonapiView do + @moduledoc false + alias CodeCorps.StripeService.Validators.ProjectCanEnableDonations + alias CodeCorps.Presenters.ImagePresenter + + use JSONAPI.View, type: "project" + use CodeCorpsWeb, :view + + def fields, do: [ + :approval_requested, + :approved, + :can_activate_donations, + :cloudinary_public_id, + :description, + :donations_active, + :icon_thumb_url, + :icon_large_url, + :inserted_at, + :long_description_body, + :long_description_markdown, + :should_link_externally, + :slug, + :title, + :total_monthly_donated, + :updated_at, + :website + ] + + def can_activate_donations(project, _conn) do + case ProjectCanEnableDonations.validate(project) do + {:ok, _} -> true + {:error, _} -> false + end + end + + def donations_active(project, _conn) do + Enum.any?(project.donation_goals) && project.stripe_connect_plan != nil + end + + def icon_large_url(project, _conn), do: ImagePresenter.large(project) + + def icon_thumb_url(project, _conn), do: ImagePresenter.thumbnail(project) +end diff --git a/lib/code_corps_web/views/project_view.ex b/lib/code_corps_web/views/project_view.ex index 57087b3ad..44916670c 100644 --- a/lib/code_corps_web/views/project_view.ex +++ b/lib/code_corps_web/views/project_view.ex @@ -36,8 +36,6 @@ defmodule CodeCorpsWeb.ProjectView do has_many :project_skills, serializer: CodeCorpsWeb.ProjectSkillView, identifiers: :always has_many :project_users, serializer: CodeCorpsWeb.ProjectUserView, identifiers: :always has_many :skills, serializer: CodeCorpsWeb.SkillView, identifiers: :always - has_many :tasks, serializer: CodeCorpsWeb.TaskView, identifiers: :always - has_many :task_lists, serializer: CodeCorpsWeb.TaskListView, identifiers: :always def can_activate_donations(project, _conn) do case ProjectCanEnableDonations.validate(project) do diff --git a/lib/code_corps_web/views/task_jsonapi_view.ex b/lib/code_corps_web/views/task_jsonapi_view.ex new file mode 100644 index 000000000..a7f41c06e --- /dev/null +++ b/lib/code_corps_web/views/task_jsonapi_view.ex @@ -0,0 +1,43 @@ +defmodule CodeCorpsWeb.TaskJsonapiView do + @moduledoc false + use CodeCorpsWeb, :view + use JSONAPI.View, type: "task" + + def fields, do: [ + :archived, :body, :created_at, :created_from, :has_github_pull_request, + :inserted_at, :markdown, :modified_at, :modified_from, :number, :order, + :overall_status, :status, :title, :updated_at + ] + + # def relationships do + # [github_issue] + # end + + # has_one :github_issue, type: "github-issue", field: :github_issue_id + # has_one :github_pull_request, serializer: CodeCorpsWeb.GithubPullRequestView, identifiers: :always + # has_one :github_repo, type: "github-repo", field: :github_repo_id + # has_one :project, type: "project", field: :project_id + # has_one :task_list, type: "task-list", field: :task_list_id + # has_one :user, type: "user", field: :user_id + # has_one :user_task, serializer: CodeCorpsWeb.UserTaskView, identifiers: :always + + # has_many :comments, serializer: CodeCorpsWeb.CommentView, identifiers: :always + # has_many :task_skills, serializer: CodeCorpsWeb.TaskSkillView, identifiers: :always + + def has_github_pull_request(%{ + github_pull_request: %CodeCorps.GithubPullRequest{} + }), do: true + def has_github_pull_request(%{github_pull_request: nil}), do: false + + def overall_status(%{ + github_pull_request: %CodeCorps.GithubPullRequest{merged: merged, state: state} + }, _conn) do + case merged do + true -> "merged" + false -> state + end + end + def overall_status(%{github_pull_request: nil, status: status}, _conn) do + status + end +end \ No newline at end of file diff --git a/lib/code_corps_web/views/task_list_view.ex b/lib/code_corps_web/views/task_list_view.ex index dd5348fdf..76530216a 100644 --- a/lib/code_corps_web/views/task_list_view.ex +++ b/lib/code_corps_web/views/task_list_view.ex @@ -3,11 +3,11 @@ defmodule CodeCorpsWeb.TaskListView do use CodeCorpsWeb, :view use JSONAPI.View, type: "task-list" - alias CodeCorpsWeb.{ProjectView, TaskView} + alias CodeCorpsWeb.{ProjectJsonapiView, TaskJsonapiView} def fields, do: [:done, :inbox, :name, :order, :pull_requests, :inserted_at, :updated_at] def relationships do - [project: ProjectView, tasks: TaskView] + [project: {ProjectJsonapiView, :include}, tasks: {TaskJsonapiView, :include}] end end diff --git a/test/lib/code_corps_web/views/project_view_test.exs b/test/lib/code_corps_web/views/project_view_test.exs index 5b63d9dc4..dc6ba34ce 100644 --- a/test/lib/code_corps_web/views/project_view_test.exs +++ b/test/lib/code_corps_web/views/project_view_test.exs @@ -12,8 +12,6 @@ defmodule CodeCorpsWeb.ProjectViewTest do project_skill = insert(:project_skill, project: project, skill: skill) project_user = insert(:project_user, project: project) stripe_connect_plan = insert(:stripe_connect_plan, project: project) - task_list = insert(:task_list, project: project) - task = insert(:task, task_list: task_list, project: project) host = Application.get_env(:code_corps, :asset_host) @@ -102,22 +100,6 @@ defmodule CodeCorpsWeb.ProjectViewTest do "id" => stripe_connect_plan.id |> Integer.to_string, "type" => "stripe-connect-plan" } - }, - "task-lists" => %{ - "data" => [ - %{ - "id" => task_list.id |> Integer.to_string, - "type" => "task-list" - } - ] - }, - "tasks" => %{ - "data" => [ - %{ - "id" => task.id |> Integer.to_string, - "type" => "task" - } - ] } }, "type" => "project", diff --git a/test/lib/code_corps_web/views/task_list_view_test.exs b/test/lib/code_corps_web/views/task_list_view_test.exs index 0f73e7fcc..efaa6849d 100644 --- a/test/lib/code_corps_web/views/task_list_view_test.exs +++ b/test/lib/code_corps_web/views/task_list_view_test.exs @@ -1,7 +1,6 @@ defmodule CodeCorpsWeb.TaskListViewTest do use CodeCorpsWeb.ViewCase - @tag :wip test "renders all attributes and relationships properly" do project = insert(:project) task_list = insert(:task_list, order: 1000, project: project) @@ -38,7 +37,48 @@ defmodule CodeCorpsWeb.TaskListViewTest do }, type: "task-list", }, - :included => [], + :included => [ + %{ + attributes: %{ + "approval-requested" => false, + "approved" => project.approved, + "cloudinary-public-id" => nil, + "description" => project.description, + "inserted-at" => project.inserted_at, + "long-description-body" => project.long_description_body, + "long-description-markdown" => project.long_description_markdown, + "should-link-externally" => false, + "slug" => project.slug, + "title" => project.title, + "total-monthly-donated" => 0, + "updated-at" => project.updated_at, + "website" => project.website + }, + id: project.id |> Integer.to_string, + relationships: %{}, + type: "project" + }, + %{ + attributes: %{ + "archived" => false, + "body" => nil, + "created-at" => task.created_at, + "created-from" => task.created_from, + "inserted-at" => task.inserted_at, + "markdown" => "A test task", + "modified-at" => task.modified_at, + "modified-from" => task.modified_from, + "number" => task.number, + "order" => task.order, + "status" => task.status, + "title" => task.title, + "updated-at" => task.updated_at + }, + id: task.id |> Integer.to_string, + relationships: %{}, + type: "task" + } + ], :links => %{} }