This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from thauma9/master
ADD categories retrieval
- Loading branch information
Showing
7 changed files
with
91 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Binda::Api::Types::CategoryType = GraphQL::ObjectType.define do |context| | ||
name 'Binda_Category' | ||
context.field :id, context.types.ID | ||
context.field :name, context.types.String | ||
context.field :slug, context.types.String | ||
context.field :position, context.types.Int | ||
|
||
::Binda::Api::Fields::SHARED_FIELDS.call(context) | ||
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
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
Binda::Api::Types::StructureType = GraphQL::ObjectType.define do | ||
Binda::Api::Types::StructureType = GraphQL::ObjectType.define do |context| | ||
name "Binda_Structure" | ||
|
||
field :id, !types.ID | ||
field :name, !types.String | ||
|
||
context.field :get_categories, ::Binda::Api::Types::CategoryType.to_list_type do | ||
resolve ->(obj, args, ctx) { | ||
obj.categories.order("binda_categories.position") | ||
} | ||
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
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,8 @@ | ||
FactoryBot.define do | ||
sequence(:category_name) { |n| "Test Category ##{n}" } | ||
|
||
factory :category, class: Binda::Category do | ||
name { generate :category_name } | ||
association :structure | ||
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
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