ash_graphql/lib/resource/mutation.ex

56 lines
1.2 KiB
Elixir
Raw Normal View History

2020-08-14 09:39:59 +12:00
defmodule AshGraphql.Resource.Mutation do
2020-08-15 02:20:47 +12:00
@moduledoc "Represents a configured mutation on a resource"
defstruct [:name, :action, :type, :identity]
2020-08-14 09:39:59 +12:00
@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."
2020-08-14 09:39:59 +12:00
]
]
@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."
2020-08-14 09:39:59 +12:00
]
]
def create_schema, do: @create_schema
def update_schema, do: @update_schema
def destroy_schema, do: @destroy_schema
end