mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 21:32:59 +12:00
37d0b6534d
* feat: support using identities for gets
55 lines
1.2 KiB
Elixir
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
|