mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: only accept kw list in aggregate/5
This commit is contained in:
parent
42deba22f0
commit
9efe0355e8
1 changed files with 3 additions and 5 deletions
|
@ -553,22 +553,20 @@ defmodule Ash.Query do
|
|||
atom(),
|
||||
Ash.aggregate_kind(),
|
||||
atom | list(atom),
|
||||
Ash.query() | nil
|
||||
Keyword.t() | nil
|
||||
) :: t()
|
||||
def aggregate(query, name, type, relationship, agg_query \\ nil) do
|
||||
{field, agg_query} = Keyword.pop(agg_query || [], :field)
|
||||
|
||||
query = to_query(query)
|
||||
relationship = List.wrap(relationship)
|
||||
|
||||
if Ash.Resource.data_layer_can?(query.resource, {:aggregate, type}) do
|
||||
agg_query =
|
||||
case agg_query do
|
||||
nil ->
|
||||
[] ->
|
||||
nil
|
||||
|
||||
%__MODULE__{} = agg_query ->
|
||||
agg_query
|
||||
|
||||
options when is_list(options) ->
|
||||
build(Ash.Resource.related(query.resource, relationship), options)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue