mirror of
https://github.com/ash-project/ash.git
synced 2024-09-21 05:53:06 +12:00
23 lines
429 B
Elixir
23 lines
429 B
Elixir
defmodule Ash.Test.Support.PolicySimple.Calculations.PostTexts do
|
|
@moduledoc false
|
|
use Ash.Resource.Calculation
|
|
|
|
@impl true
|
|
def init(opts) do
|
|
{:ok, opts}
|
|
end
|
|
|
|
@impl true
|
|
def load(_query, _opts, _context) do
|
|
[posts: [:text]]
|
|
end
|
|
|
|
@impl true
|
|
def calculate(records, _opts, %{}) do
|
|
Enum.map(records, fn record ->
|
|
Enum.map(record.posts, fn post ->
|
|
post.text
|
|
end)
|
|
end)
|
|
end
|
|
end
|