forked from ash-project/ash_graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow retrieving a resource implementing the Node interface given its Relay global id. Close ash-project#99
- Loading branch information
Showing
6 changed files
with
235 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
test/support/relay_ids/resources/resource_with_no_primary_key_get.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
defmodule AshGraphql.Test.RelayIds.ResourceWithNoPrimaryKeyGet do | ||
@moduledoc false | ||
|
||
use Ash.Resource, | ||
data_layer: Ash.DataLayer.Ets, | ||
extensions: [AshGraphql.Resource] | ||
|
||
graphql do | ||
type :resource_with_no_primary_key_get | ||
|
||
queries do | ||
get :get_resource_by_name, :get_by_name | ||
end | ||
|
||
mutations do | ||
create :create_resource, :create | ||
end | ||
end | ||
|
||
actions do | ||
defaults([:create, :update, :destroy, :read]) | ||
|
||
read(:get_by_name, get_by: :name) | ||
end | ||
|
||
attributes do | ||
uuid_primary_key(:id) | ||
attribute(:name, :string, allow_nil?: false) | ||
end | ||
|
||
identities do | ||
identity(:name, [:name], pre_check_with: AshGraphql.Test.RelayIds.Api) | ||
end | ||
|
||
relationships do | ||
has_many(:posts, AshGraphql.Test.RelayIds.Post, destination_attribute: :author_id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters