AshGraphql unknown error
Unknown Error
* ** (UndefinedFunctionError) function :ok.resource/0 is undefined (module :ok is not available)
:ok.resource()
(elixir 1.18.4) src/elixir_erl_pass.erl:726: :elixir_erl_pass.no_parens_remote/2
(ash 3.5.15) lib/ash/notifier/notifier.ex:32: anonymous fn/1 in Ash.Notifier.notify/1
(elixir 1.18.4) lib/enum.ex:1429: anonymous fn/4 in Enum.group_by/3
(elixir 1.18.4) lib/enum.ex:2546: Enum."-group_by/3-lists^foldl/2-0-"/3
(ash 3.5.15) lib/ash/notifier/notifier.ex:32: Ash.Notifier.notify/1
(ash 3.5.15) lib/ash/actions/update/bulk.ex:1371: Ash.Actions.Update.Bulk."-do_stream_batches/7-after$^2/0-0-"/2Unknown Error
* ** (UndefinedFunctionError) function :ok.resource/0 is undefined (module :ok is not available)
:ok.resource()
(elixir 1.18.4) src/elixir_erl_pass.erl:726: :elixir_erl_pass.no_parens_remote/2
(ash 3.5.15) lib/ash/notifier/notifier.ex:32: anonymous fn/1 in Ash.Notifier.notify/1
(elixir 1.18.4) lib/enum.ex:1429: anonymous fn/4 in Enum.group_by/3
(elixir 1.18.4) lib/enum.ex:2546: Enum."-group_by/3-lists^foldl/2-0-"/3
(ash 3.5.15) lib/ash/notifier/notifier.ex:32: Ash.Notifier.notify/1
(ash 3.5.15) lib/ash/actions/update/bulk.ex:1371: Ash.Actions.Update.Bulk."-do_stream_batches/7-after$^2/0-0-"/2The code for the action is this
update :accept_for_doctor do
argument :code, :string, allow_nil?: false
argument :entity_id, :string, allow_nil?: false
require_atomic? false
validate attribute_equals(:role, :doctor)
validate attribute_equals(:code, arg(:code))
validate attributes_absent(:member_id)
validate attribute_equals(:rejected, false)
validate attribute_equals(:entity_id, arg(:entity_id))
# change log("before doctor")
change relation(
:accepted_doctor,
%{entity_id: arg(:entity_id), user_id: actor(:id)},
type: :create
)
# change log("before member")
change relation(
:member,
%{entity_id: arg(:entity_id), user_id: actor(:id), role: :doctor},
type: :create
)
# change log("after member")
end update :accept_for_doctor do
argument :code, :string, allow_nil?: false
argument :entity_id, :string, allow_nil?: false
require_atomic? false
validate attribute_equals(:role, :doctor)
validate attribute_equals(:code, arg(:code))
validate attributes_absent(:member_id)
validate attribute_equals(:rejected, false)
validate attribute_equals(:entity_id, arg(:entity_id))
# change log("before doctor")
change relation(
:accepted_doctor,
%{entity_id: arg(:entity_id), user_id: actor(:id)},
type: :create
)
# change log("before member")
change relation(
:member,
%{entity_id: arg(:entity_id), user_id: actor(:id), role: :doctor},
type: :create
)
# change log("after member")
endI made the
relationrelation change, which is just calling manage_relationship, nothing moreSolution
You can create in a
before_actionbefore_action hook and use that to update the record