Packages

Athena Event Logistics - Backend / Web

Current section

Files

Jump to
athena_logistics lib athena_web schema item_group resolver.ex
Raw

lib/athena_web/schema/item_group/resolver.ex

defmodule AthenaWeb.Schema.ItemGroup.Resolver do
@moduledoc false
use AthenaWeb, :resolver
import Ecto.Query, only: [from: 2]
alias Athena.Inventory
alias Athena.Inventory.ItemGroup
@spec stock(parent :: ItemGroup.t(), args :: map(), resolution :: Absinthe.Resolution.t()) ::
AthenaWeb.resolver_result()
def stock(%ItemGroup{id: id}, args, _resolution) do
connection_from_query(
from([event, item_group: item_group] in Inventory.stock_query(), where: item_group.id == ^id),
args,
&Repo.all/1,
nil
)
end
end