Skip to content

Commit

Permalink
fix: accept ids in code interfaces again
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed May 15, 2024
1 parent 835187d commit 5b18e71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/ash/code_interface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -798,11 +798,7 @@ defmodule Ash.CodeInterface do
{:atomic, :stream, list}

other ->
if Keyword.keyword?(other) || is_map(other) do
{:atomic, :id, other}
else
{:atomic, :stream, other}
end
{:atomic, :id, other}
end
end
else
Expand Down Expand Up @@ -1005,11 +1001,7 @@ defmodule Ash.CodeInterface do
{:atomic, :stream, list}

other ->
if Keyword.keyword?(other) || is_map(other) do
{:atomic, :id, other}
else
{:atomic, :stream, other}
end
{:atomic, :id, other}
end
end
else
Expand Down
5 changes: 5 additions & 0 deletions test/code_interface_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ defmodule Ash.Test.CodeInterfaceTest do
assert %Ash.BulkResult{status: :success} = User.destroy!([bob3, bob4], context: @context)
end

test "bulk destroy can take an id" do
bob1 = User.create!("bob", context: @context)
User.destroy!(bob1.id)
end

test "bulk destroy can take an empty list" do
assert %Ash.BulkResult{status: :success} = User.destroy([])
end
Expand Down

0 comments on commit 5b18e71

Please sign in to comment.