fix: pass entire private context to related query in lazy?: true

This commit is contained in:
Zach Daniel 2024-07-02 10:24:33 -04:00
parent f7397160b2
commit 17c92bdf3d
4 changed files with 5 additions and 8 deletions

View file

@ -35,8 +35,7 @@ if Mix.env() == :test do
config :ash, :validate_domain_config_inclusion?, false
config :ash, :policies, show_policy_breakdowns?: true
config :ash, :compatible_foreign_key_types,
[
{Ash.Type.CiString, Ash.Type.UUID}
]
config :ash, :compatible_foreign_key_types, [
{Ash.Type.CiString, Ash.Type.UUID}
]
end

View file

@ -106,9 +106,7 @@ defmodule Ash.Actions.Read.Relationships do
Ash.Domain.Info.related_domain(related_query, relationship, query.domain)
)
|> Ash.Query.set_tenant(query.tenant)
|> Ash.Query.set_context(%{
private: %{async_limiter: query.context[:private][:async_limiter]}
})}}
|> Ash.Query.set_context(%{private: query.context[:private]})}}
else
related_query(relationship_name, records, related_query, query)
end

View file

@ -305,7 +305,6 @@ defmodule Ash.Actions.Update do
maybe_is: false
) do
{:ok, true, changeset} ->
# foobar
changeset
{:ok, false, error} ->

View file

@ -27,6 +27,7 @@ defmodule Ash.Type.UUID do
def cast_input(nil, _), do: {:ok, nil}
def cast_input(%Ash.CiString{string: string}, constraints), do: cast_input(string, constraints)
def cast_input(value, _) when is_binary(value) do
case String.valid?(value) do
true -> Ecto.Type.cast(Ecto.UUID, String.trim(value))