Provide totalItems field for featured collections

This commit is contained in:
Mark Felder 2021-05-27 12:04:42 -05:00
parent f34e22bba2
commit 4694853766
2 changed files with 3 additions and 2 deletions

View file

@ -261,7 +261,8 @@ def render("featured.json", %{
%{
"id" => featured_address,
"type" => "OrderedCollection",
"orderedItems" => objects
"orderedItems" => objects,
"totalItems" => length(objects)
}
|> Map.merge(Utils.make_json_ld_header())
end

View file

@ -1966,7 +1966,7 @@ test "pinned collection", %{conn: conn} do
%{nickname: nickname, featured_address: featured_address, pinned_objects: pinned_objects} =
refresh_record(user)
%{"id" => ^featured_address, "orderedItems" => items} =
%{"id" => ^featured_address, "orderedItems" => items, "totalItems" => 2} =
conn
|> get("/users/#{nickname}/collections/featured")
|> json_response(200)