Skip to content

Commit

Permalink
fix: pass metadata argument on the udpate action
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Oct 7, 2023
1 parent da13981 commit 981e659
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/transformers/define_schedulers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ defmodule AshOban.Transformers.DefineSchedulers do
else
quote location: :keep do
@impl unquote(worker)
def unquote(function_name)(%Oban.Job{args: %{"primary_key" => primary_key}} = job) do
def unquote(function_name)(%Oban.Job{args: %{"primary_key" => primary_key} = args} = job) do
AshOban.debug(
"Trigger #{unquote(inspect(resource))}.#{unquote(trigger.name)} triggered for primary key #{inspect(primary_key)}",
unquote(trigger.debug?)
Expand All @@ -514,7 +514,9 @@ defmodule AshOban.Transformers.DefineSchedulers do
|> Ash.Changeset.new()
|> prepare(primary_key)
|> Ash.Changeset.set_context(%{private: %{ash_oban?: true}})
|> Ash.Changeset.for_action(unquote(trigger.action), %{})
|> Ash.Changeset.for_action(unquote(trigger.action), %{
metadata: args["metadata"] || %{}
})
|> AshOban.update_or_destroy(unquote(api))
|> case do
:ok ->
Expand Down

0 comments on commit 981e659

Please sign in to comment.