You can do that with bulk destroy actions. We will be working on guides that explain how to use bulk actions more than what exists currently. But you can do this:
read :my_thumb_ups do
filter expr(id == ^actor(:id))
end
ThumbUp
|> Ash.Query.for_read(:my_thumb_ups, %{}, actor: actor)
|> Ash.Query.filter(dental_lab_post.id == ^post_id)
|> ThumbUp.bulk_destroy!(:destroy)
You can put this behind a generic action:
action :remove, :atom do
constraints one_of: [:ok]
argument :post_id, :uuid, allow_nil?: false
run fn input, context ->
ThumbUp
|> Ash.Query.for_read(:my_thumb_ups, %{}, Ash.context_to_opts(context))
|> Ash.Query.filter(dental_lab_post.id == ^input.post_id)
|> ThumbUp.bulk_destroy!(:destroy)
{:ok, :ok}
end
end
And then you can put that in your code_interface:
code_interface do
define_for YourApi
define :remove, args: [:post_id]
end
Then you can call it:
ThumbUp.remove!(post.id)






















