site_blog 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/migrate/20230201140930_add_article_and_tag.rb +1 -1
- data/lib/site_blog/version.rb +1 -1
- metadata +1 -43
- data/app/graphql/site_blog/mutations/base_mutation.rb +0 -10
- data/app/graphql/site_blog/schema.rb +0 -28
- data/app/graphql/site_blog/types/article_type.rb +0 -12
- data/app/graphql/site_blog/types/base_argument.rb +0 -6
- data/app/graphql/site_blog/types/base_enum.rb +0 -6
- data/app/graphql/site_blog/types/base_field.rb +0 -7
- data/app/graphql/site_blog/types/base_input_object.rb +0 -7
- data/app/graphql/site_blog/types/base_interface.rb +0 -9
- data/app/graphql/site_blog/types/base_object.rb +0 -7
- data/app/graphql/site_blog/types/base_scalar.rb +0 -6
- data/app/graphql/site_blog/types/base_union.rb +0 -6
- data/app/graphql/site_blog/types/mutation_type.rb +0 -11
- data/app/graphql/site_blog/types/query_type.rb +0 -38
- data/app/graphql/site_blog/types/tag_type.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e76714792d33e9b0a08f1fc2d643f0caccad3bb083b77662bd9bcdfa02f07709
|
4
|
+
data.tar.gz: a261eec84ec7a2e8778792b49dc9e9e62bbcdeff56cd9d82b8012999b1a3e8cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc839fa55585d4b3d27aab8feeacdec64be32423bb8a94356d26b9897abc4902d0d737dacb513eee8395fcc526f9291677b7a678bd7552c881ff970612998e14
|
7
|
+
data.tar.gz: a5a842079e9e679a02b45526f8068cf3e503b85c2f201dfd118117856f1a223d2a5a9a2f63c10bebf6b1e2ba8853da3f18c84c40c8d8ad82a851319c1e9389b0
|
@@ -20,7 +20,7 @@ class AddArticleAndTag < ActiveRecord::Migration[7.0]
|
|
20
20
|
t.timestamps
|
21
21
|
end
|
22
22
|
|
23
|
-
create_table :
|
23
|
+
create_table :site_blog_taggings do |t|
|
24
24
|
t.belongs_to :article, foreign_key: { to_table: :site_blog_articles }
|
25
25
|
t.belongs_to :tag, foreign_key: { to_table: :site_blog_tags }
|
26
26
|
t.timestamps
|
data/lib/site_blog/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eldar
|
@@ -80,34 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: graphql
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: graphiql-rails
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: activeadmin_addons
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,20 +110,6 @@ files:
|
|
138
110
|
- app/controllers/site_blog/articles_controller.rb
|
139
111
|
- app/controllers/site_blog/graphql_controller.rb
|
140
112
|
- app/controllers/site_blog/tags_controller.rb
|
141
|
-
- app/graphql/site_blog/mutations/base_mutation.rb
|
142
|
-
- app/graphql/site_blog/schema.rb
|
143
|
-
- app/graphql/site_blog/types/article_type.rb
|
144
|
-
- app/graphql/site_blog/types/base_argument.rb
|
145
|
-
- app/graphql/site_blog/types/base_enum.rb
|
146
|
-
- app/graphql/site_blog/types/base_field.rb
|
147
|
-
- app/graphql/site_blog/types/base_input_object.rb
|
148
|
-
- app/graphql/site_blog/types/base_interface.rb
|
149
|
-
- app/graphql/site_blog/types/base_object.rb
|
150
|
-
- app/graphql/site_blog/types/base_scalar.rb
|
151
|
-
- app/graphql/site_blog/types/base_union.rb
|
152
|
-
- app/graphql/site_blog/types/mutation_type.rb
|
153
|
-
- app/graphql/site_blog/types/query_type.rb
|
154
|
-
- app/graphql/site_blog/types/tag_type.rb
|
155
113
|
- app/helpers/site_blog/application_helper.rb
|
156
114
|
- app/helpers/site_blog/articles_helper.rb
|
157
115
|
- app/helpers/site_blog/tags_helper.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module SiteBlog
|
2
|
-
class Schema < GraphQL::Schema
|
3
|
-
mutation(Types::MutationType)
|
4
|
-
query(Types::QueryType)
|
5
|
-
|
6
|
-
# For batch-loading (see https://graphql-ruby.org/dataloader/overview.html)
|
7
|
-
use GraphQL::Dataloader
|
8
|
-
|
9
|
-
# GraphQL-Ruby calls this when something goes wrong while running a query:
|
10
|
-
def self.type_error(err, context)
|
11
|
-
# if err.is_a?(GraphQL::InvalidNullError)
|
12
|
-
# # report to your bug tracker here
|
13
|
-
# return nil
|
14
|
-
# end
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
# Union and Interface Resolution
|
19
|
-
def self.resolve_type(abstract_type, obj, ctx)
|
20
|
-
# TODO: Implement this method
|
21
|
-
# to return the correct GraphQL object type for `obj`
|
22
|
-
raise(GraphQL::RequiredImplementationMissingError)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Stop validating when it encounters this many errors:
|
26
|
-
validate_max_errors(100)
|
27
|
-
end
|
28
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module SiteBlog
|
2
|
-
module Types
|
3
|
-
class ArticleType < Types::BaseObject
|
4
|
-
description "A blog article"
|
5
|
-
field :id, ID, null: false
|
6
|
-
field :title, String, null: false
|
7
|
-
field :html_description, String, null: false
|
8
|
-
field :tag, TagType, null: false, description: "This post's tag"
|
9
|
-
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module SiteBlog
|
2
|
-
module Types
|
3
|
-
class QueryType < Types::BaseObject
|
4
|
-
|
5
|
-
field :articles, [ArticleType], null: false, description: "Вывод всех постов" do
|
6
|
-
argument :page, Int, required: false, description: 'Номер страницы'
|
7
|
-
argument :tag_id, Int, required: false, description: 'ID тега'
|
8
|
-
argument :query, String, required: false, description: 'Поисковый запрос'
|
9
|
-
end
|
10
|
-
|
11
|
-
def articles(page: 1, tag_id: nil, query: nil)
|
12
|
-
Article.preload(:tag).filters({page: page, tag_id: tag_id, query: query})
|
13
|
-
end
|
14
|
-
|
15
|
-
field :article, ArticleType, "Поиск поста по ID" do
|
16
|
-
argument :id, ID
|
17
|
-
end
|
18
|
-
|
19
|
-
def article(id:)
|
20
|
-
Article.find(id)
|
21
|
-
end
|
22
|
-
|
23
|
-
field :tags, [TagType], null: false, description: "Вывод всех тегов"
|
24
|
-
def tags
|
25
|
-
Tag.all
|
26
|
-
end
|
27
|
-
|
28
|
-
field :tag, TagType, "Поиск тега по ID" do
|
29
|
-
argument :id, ID
|
30
|
-
end
|
31
|
-
|
32
|
-
def tag(id:)
|
33
|
-
Tag.find(id)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|