diff --git a/lib/jsonapi/config.ex b/lib/jsonapi/config.ex index 0f279790..0e7a3811 100644 --- a/lib/jsonapi/config.ex +++ b/lib/jsonapi/config.ex @@ -9,7 +9,8 @@ defmodule JSONAPI.Config do include: [], opts: nil, sort: nil, - view: nil + view: nil, + page: %{} @type t :: %__MODULE__{ data: nil | map, @@ -18,6 +19,7 @@ defmodule JSONAPI.Config do include: [atom | {atom, any}], opts: nil | keyword, sort: nil | keyword, - view: any + view: any, + page: nil | map } end diff --git a/lib/jsonapi/plugs/query_parser.ex b/lib/jsonapi/plugs/query_parser.ex index 78a80b3a..ab12ccb2 100644 --- a/lib/jsonapi/plugs/query_parser.ex +++ b/lib/jsonapi/plugs/query_parser.ex @@ -102,15 +102,14 @@ defmodule JSONAPI.QueryParser do |> parse_include(query_params_config_struct.include) |> parse_filter(query_params_config_struct.filter) |> parse_sort(query_params_config_struct.sort) - - # |> parse_pagination(query_params_config_struct.page) + |> parse_pagination(query_params_config_struct.page) Conn.assign(conn, :jsonapi_query, config) end def parse_pagination(config, map) when map_size(map) == 0, do: config - # def parse_pagination(%Config{} = config, page), do: Map.put(config, :page, page) + def parse_pagination(%Config{} = config, page), do: Map.put(config, :page, page) @spec parse_filter(Config.t(), keyword()) :: Config.t() def parse_filter(config, map) when map_size(map) == 0, do: config