From 5b18e71738736d10498cc7591a5251e71f0fc357 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Wed, 15 May 2024 15:45:58 -0400 Subject: [PATCH] fix: accept ids in code interfaces again --- lib/ash/code_interface.ex | 12 ++---------- test/code_interface_test.exs | 5 +++++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/ash/code_interface.ex b/lib/ash/code_interface.ex index 176034c1..07b670e8 100644 --- a/lib/ash/code_interface.ex +++ b/lib/ash/code_interface.ex @@ -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 diff --git a/test/code_interface_test.exs b/test/code_interface_test.exs index 833214b1..6722d19e 100644 --- a/test/code_interface_test.exs +++ b/test/code_interface_test.exs @@ -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