chore: release version v1.1.0

This commit is contained in:
Zach Daniel 2024-05-24 15:53:09 -04:00
parent a6ca7fea67
commit 3be2f32896
4 changed files with 58 additions and 3 deletions

View file

@ -5,6 +5,12 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v1.1.0](https://github.com/ash-project/ash_graphql/compare/v1.0.1...v1.1.0) (2024-05-24)
### Features:
- [AshGraphql.Domain] support queries/mutations on the domain
## [v1.0.1](https://github.com/ash-project/ash_graphql/compare/v1.0.0...v1.0.1) (2024-05-23)
### Features:

View file

@ -2,6 +2,8 @@
Following where we left off from [Getting Started with GraphQL](/documentation/tutorials/getting-started-with-graphql.md), this guide explores what the GraphQL requests and responses look like for different queries defined with the AshGraphql DSL.
All of the following examples apply to queries & mutations places on the domain as well.
## Fetch Data by ID
```elixir

View file

@ -10,7 +10,7 @@ If you haven't already, read the [Ash Getting Started Guide](https://hexdocs.pm/
def deps()
[
...
{:ash_graphql, "~> 1.0.1"}
{:ash_graphql, "~> 1.1.0"}
]
end
```
@ -37,8 +37,12 @@ end
Some example queries/mutations are shown below. If no queries/mutations are added, nothing will show up in the GraphQL API, so be sure to set one up if you want to try it out.
### Queries & Mutations on the Resource
Here we show queries and mutations being added to the resource, but you can also define them on the _domain_. See below for an equivalent definition
```elixir
defmodule Helpdesk.Support.Ticket. do
defmodule Helpdesk.Support.Ticket do
use Ash.Resource,
...,
extensions: [
@ -73,6 +77,49 @@ defmodule Helpdesk.Support.Ticket. do
end
```
### Queries & Mutations on the Domain
```elixir
defmodule Helpdesk.Support.Ticket do
use Ash.Resource,
...,
extensions: [
AshGraphql.Resource
]
# The resource still determines its type, and any other resource/type-based
# configuration
graphql do
type :ticket
end
...
end
defmodule Helpdesk.Support do
use Ash.Domain,
extensions: [
AshGraphql.Domain
]
graphql do
# equivalent queries and mutations, but the first argument
# is the resource because the domain can define queries for
# any of its resources
queries do
get Helpdesk.Support.Ticket, :get_ticket, :read
read_one Helpdesk.Support.Ticket, :most_important_ticket, :most_important
list Helpdesk.Support.Ticket, :list_tickets, :read
end
mutations do
create Helpdesk.Support.Ticket, :create_ticket, :create
update Helpdesk.Support.Ticket, :update_ticket, :update
destroy Helpdesk.Support.Ticket, :destroy_ticket, :destroy
end
end
```
## Add AshGraphql to your schema
If you don't have an absinthe schema, you can create one just for ash.

View file

@ -5,7 +5,7 @@ defmodule AshGraphql.MixProject do
The extension for building GraphQL APIs with Ash
"""
@version "1.0.1"
@version "1.1.0"
def project do
[