Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/code_corps_web/controllers/project_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ defmodule CodeCorpsWeb.ProjectController do
end

@preloads [
:donation_goals, :github_repos, [organization: :stripe_connect_account],
:categories, :donation_goals, :github_repos,
[organization: :stripe_connect_account],
:project_categories, :project_skills, :project_users, :stripe_connect_plan,
:task_lists, :tasks
]
Expand Down
2 changes: 1 addition & 1 deletion lib/code_corps_web/controllers/user_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ defmodule CodeCorpsWeb.UserController do
end

@preloads [
:github_app_installations, :project_users, :slugged_route,
:categories, :github_app_installations, :project_users, :slugged_route,
:stripe_connect_subscriptions, :stripe_platform_card,
:stripe_platform_customer, :user_categories, :user_roles, :user_skills
]
Expand Down
1 change: 1 addition & 0 deletions lib/code_corps_web/views/project_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule CodeCorpsWeb.ProjectView do
has_one :organization, type: "organization", field: :organization_id
has_one :stripe_connect_plan, serializer: CodeCorpsWeb.StripeConnectPlanView

has_many :categories, serializer: CodeCorpsWeb.CategoryView, identifiers: :always
has_many :donation_goals, serializer: CodeCorpsWeb.DonationGoalView, identifiers: :always
has_many :github_repos, serializer: CodeCorpsWeb.GithubRepoView, identifiers: :always
has_many :project_categories, serializer: CodeCorpsWeb.ProjectCategoryView, identifiers: :always
Expand Down
1 change: 1 addition & 0 deletions lib/code_corps_web/views/user_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule CodeCorpsWeb.UserView do
has_one :stripe_platform_card, serializer: CodeCorpsWeb.StripePlatformCardView
has_one :stripe_platform_customer, serializer: CodeCorpsWeb.StripePlatformCustomerView

has_many :categories, serializer: CodeCorpsWeb.CategoryView, identifiers: :always
has_many :github_app_installations, serializer: CodeCorpsWeb.GithubAppInstallationView, identifiers: :always
has_many :project_users, serializer: CodeCorpsWeb.ProjectUserView, identifiers: :always
has_many :stripe_connect_subscriptions, serializer: CodeCorpsWeb.StripeConnectSubscriptionView, identifiers: :always
Expand Down
5 changes: 5 additions & 0 deletions test/lib/code_corps_web/views/project_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ defmodule CodeCorpsWeb.ProjectViewTest do
},
"id" => project.id |> Integer.to_string,
"relationships" => %{
"categories" => %{
"data" => [
%{"id" => project_category.category_id |> Integer.to_string, "type" => "category"}
]
},
"donation-goals" => %{"data" => [
%{
"id" => donation_goal.id |> Integer.to_string,
Expand Down
5 changes: 5 additions & 0 deletions test/lib/code_corps_web/views/user_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ defmodule CodeCorpsWeb.UserViewTest do
"website" => user.website
},
"relationships" => %{
"categories" => %{
"data" => [
%{"id" => user_category.category_id |> Integer.to_string, "type" => "category"}
]
},
"github-app-installations" => %{
"data" => [
%{"id" => github_app_installation.id |> Integer.to_string, "type" => "github-app-installation"}
Expand Down