fix: accept ids in code interfaces again

This commit is contained in:
Zach Daniel 2024-05-15 15:45:58 -04:00
parent 835187df49
commit 5b18e71738
2 changed files with 7 additions and 10 deletions

View file

@ -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
@ -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

View file

@ -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