Skip to content

Commit

Permalink
feat: add api series season count
Browse files Browse the repository at this point in the history
  • Loading branch information
trueChazza committed Aug 16, 2024
1 parent 53194bd commit a76feb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/media_server_web/controllers/series_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defmodule MediaServerWeb.SeriesController do
"title" => x["title"],
"overview" => x["overview"],
"year" => x["year"],
"seasonCount" => x["statistics"]["seasonCount"],
"poster" => ~p"/api/images?series=#{x["id"]}&type=poster",
"background" => ~p"/api/images?series=#{x["id"]}&type=background"
}
Expand Down Expand Up @@ -53,6 +54,7 @@ defmodule MediaServerWeb.SeriesController do
"title" => x["title"],
"overview" => x["overview"],
"year" => x["year"],
"seasonCount" => x["statistics"]["seasonCount"],
"poster" => ~p"/api/images?series=#{x["id"]}&type=poster",
"background" => ~p"/api/images?series=#{x["id"]}&type=background"
}
Expand Down
4 changes: 2 additions & 2 deletions test/media_server_web/controllers/series_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ defmodule MediaServerWeb.SeriesControllerTest do

assert conn.status === 200

assert conn.resp_body === "{\"items\":[{\"background\":\"/api/images?series=1&type=background\",\"id\":1,\"overview\":\"An object in the sky spreads radiation over North America. Fearing terrorism, U.S. Homeland Security agents are dispatched to investigate and contain the damage. What they discover will have implications for the entire world.\",\"poster\":\"/api/images?series=1&type=poster\",\"title\":\"Pioneer One\",\"year\":2010}],\"next_page\":\"/api/series?page=2\",\"prev_page\":\"/api/series?page=0\",\"total\":1}"
assert conn.resp_body === "{\"items\":[{\"background\":\"/api/images?series=1&type=background\",\"id\":1,\"overview\":\"An object in the sky spreads radiation over North America. Fearing terrorism, U.S. Homeland Security agents are dispatched to investigate and contain the damage. What they discover will have implications for the entire world.\",\"poster\":\"/api/images?series=1&type=poster\",\"seasonCount\":1,\"title\":\"Pioneer One\",\"year\":2010}],\"next_page\":\"/api/series?page=2\",\"prev_page\":\"/api/series?page=0\",\"total\":1}"
end

test "it should have all paged", %{conn: conn, user: user} do
conn = get(conn, ~p"/api/series?page=1&token=#{user.api_token.token}")

assert conn.status === 200

assert conn.resp_body === "{\"items\":[{\"background\":\"/api/images?series=1&type=background\",\"id\":1,\"overview\":\"An object in the sky spreads radiation over North America. Fearing terrorism, U.S. Homeland Security agents are dispatched to investigate and contain the damage. What they discover will have implications for the entire world.\",\"poster\":\"/api/images?series=1&type=poster\",\"title\":\"Pioneer One\",\"year\":2010}],\"next_page\":\"/api/series?page=2\",\"prev_page\":\"/api/series?page=0\",\"total\":1}"
assert conn.resp_body === "{\"items\":[{\"background\":\"/api/images?series=1&type=background\",\"id\":1,\"overview\":\"An object in the sky spreads radiation over North America. Fearing terrorism, U.S. Homeland Security agents are dispatched to investigate and contain the damage. What they discover will have implications for the entire world.\",\"poster\":\"/api/images?series=1&type=poster\",\"seasonCount\":1,\"title\":\"Pioneer One\",\"year\":2010}],\"next_page\":\"/api/series?page=2\",\"prev_page\":\"/api/series?page=0\",\"total\":1}"
end

test "it should NOT have all paged", %{conn: conn, user: user} do
Expand Down

0 comments on commit a76feb3

Please sign in to comment.