Class: Blog::Types::QueryType
- Inherits:
-
BaseObject
- Object
- GraphQL::Schema::Object
- BaseObject
- Blog::Types::QueryType
- Defined in:
- app/graphql/blog/types/query_type.rb
Instance Method Summary collapse
- #article(id:) ⇒ Object
- #articles(page: 1, tag_id: nil, query: nil) ⇒ Object
- #tag(id:) ⇒ Object
- #tags ⇒ Object
Instance Method Details
#article(id:) ⇒ Object
19 20 21 |
# File 'app/graphql/blog/types/query_type.rb', line 19 def article(id:) Article.find(id) end |
#articles(page: 1, tag_id: nil, query: nil) ⇒ Object
11 12 13 |
# File 'app/graphql/blog/types/query_type.rb', line 11 def articles(page: 1, tag_id: nil, query: nil) Article.preload(:tag).filters({page: page, tag_id: tag_id, query: query}) end |
#tag(id:) ⇒ Object
32 33 34 |
# File 'app/graphql/blog/types/query_type.rb', line 32 def tag(id:) Tag.find(id) end |
#tags ⇒ Object
24 25 26 |
# File 'app/graphql/blog/types/query_type.rb', line 24 def Tag.all end |