ash_graphql/lib/resource/mutation.ex
Zach Daniel 37d0b6534d
feat: Support configuring identities (#8)
* feat: support using identities for gets
2020-11-18 02:14:33 -05:00

55 lines
1.2 KiB
Elixir

defmodule AshGraphql.Resource.Mutation do
@moduledoc "Represents a configured mutation on a resource"
defstruct [:name, :action, :type, :identity]
@create_schema [
name: [
type: :atom,
doc: "The name to use for the mutation.",
default: :get
],
action: [
type: :atom,
doc: "The action to use for the mutation.",
required: true
]
]
@update_schema [
name: [
type: :atom,
doc: "The name to use for the mutation.",
default: :get
],
action: [
type: :atom,
doc: "The action to use for the mutation.",
required: true
],
identity: [
type: :atom,
doc: "The identity to use to fetch the record to be updated."
]
]
@destroy_schema [
name: [
type: :atom,
doc: "The name to use for the mutation.",
default: :get
],
action: [
type: :atom,
doc: "The action to use for the mutation.",
required: true
],
identity: [
type: :atom,
doc: "The identity to use to fetch the record to be destroyed."
]
]
def create_schema, do: @create_schema
def update_schema, do: @update_schema
def destroy_schema, do: @destroy_schema
end