graphql_scaffold_fan 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +4 -4
- data/lib/generators/graphql_scaffold/init_generator.rb +3 -5
- data/lib/generators/templates/admin_controller.haml +6 -2
- data/lib/generators/templates/admin_filter.haml +3 -1
- data/lib/generators/templates/admin_schema.haml +5 -2
- data/lib/generators/templates/base_admin_mutation.haml +3 -1
- data/lib/generators/templates/base_object.haml +2 -1
- data/lib/generators/templates/list_metadata_type.haml +2 -0
- data/lib/generators/templates/mutation_create.haml +6 -4
- data/lib/generators/templates/mutation_create_test.haml +3 -1
- data/lib/generators/templates/mutation_delete.haml +3 -1
- data/lib/generators/templates/mutation_delete_test.haml +3 -1
- data/lib/generators/templates/mutation_test.haml +3 -4
- data/lib/generators/templates/mutation_type.haml +2 -1
- data/lib/generators/templates/mutation_update.haml +3 -0
- data/lib/generators/templates/mutation_update_test.haml +3 -1
- data/lib/generators/templates/query_test.haml +3 -2
- data/lib/generators/templates/query_type.haml +2 -1
- data/lib/graphql_scaffold_fan/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd748283918d5930f5362003773250fee8431e809120a3cbef546662110b404
|
4
|
+
data.tar.gz: 533cc9e4867e83c327da5b3121d9a111f289670a185a0ef8cb5352aa3ceb63e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfdaa2f0554c2e30367137be386784fa4d1eba0853a07855d0af62346843eaa950fa0a65dd5bb26d833fd472c1bc28e535f450bcc655483a143c55f9adeed13b
|
7
|
+
data.tar.gz: f3dbf2b6fcb54f85e0bf259398b99aee011fc60c045bb361ab60c36beee701c5c8a79f83c36979140807bd697335eacdfc2a65d5a43bb1ac992ad01a0358fe7d
|
data/.DS_Store
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
graphql_scaffold_fan (0.2.
|
4
|
+
graphql_scaffold_fan (0.2.5)
|
5
5
|
graphql
|
6
6
|
graphql_playground-rails
|
7
7
|
|
@@ -73,7 +73,7 @@ GEM
|
|
73
73
|
erubi (1.10.0)
|
74
74
|
globalid (1.0.0)
|
75
75
|
activesupport (>= 5.0)
|
76
|
-
graphql (2.0.
|
76
|
+
graphql (2.0.12)
|
77
77
|
graphql_playground-rails (2.1.0)
|
78
78
|
rails (>= 5.1.0)
|
79
79
|
i18n (1.12.0)
|
@@ -88,7 +88,7 @@ GEM
|
|
88
88
|
mini_mime (1.1.2)
|
89
89
|
minitest (5.16.2)
|
90
90
|
nio4r (2.5.8)
|
91
|
-
nokogiri (1.13.
|
91
|
+
nokogiri (1.13.8-x86_64-darwin)
|
92
92
|
racc (~> 1.4)
|
93
93
|
racc (1.6.0)
|
94
94
|
rack (2.2.4)
|
@@ -129,7 +129,7 @@ GEM
|
|
129
129
|
activesupport (>= 5.2)
|
130
130
|
sprockets (>= 3.0.0)
|
131
131
|
thor (1.2.1)
|
132
|
-
tzinfo (2.0.
|
132
|
+
tzinfo (2.0.5)
|
133
133
|
concurrent-ruby (~> 1.0)
|
134
134
|
websocket-driver (0.7.5)
|
135
135
|
websocket-extensions (>= 0.1.0)
|
@@ -17,13 +17,12 @@ module GraphqlScaffold
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def create_admin_schema_file
|
20
|
-
@top_folder_name = File.basename(Dir.getwd)
|
21
20
|
dir_path = 'app/graphql'
|
22
|
-
file_path = dir_path + "/#{
|
21
|
+
file_path = dir_path + "/#{file_name.underscore}_admin_schema.rb"
|
23
22
|
FileUtils.mkdir_p(dir_path) unless File.exist?(dir_path)
|
24
23
|
|
25
24
|
if File.exist?(file_path)
|
26
|
-
p "File #{
|
25
|
+
p "File #{file_name}_admin_schema.rb already exists"
|
27
26
|
else
|
28
27
|
template 'admin_schema.haml', file_path
|
29
28
|
end
|
@@ -50,7 +49,7 @@ module GraphqlScaffold
|
|
50
49
|
if File.exist?(route_file_path)
|
51
50
|
file = File.open(route_file_path)
|
52
51
|
file_data = file.read
|
53
|
-
new_file_data = file_data.insert(-6, "\n mount GraphqlPlayground::Rails::Engine, at: '/graphiql_admin', graphql_path: 'api/admin/graphql', as: :admin_graphiql\n post 'api/admin/graphql', to: '
|
52
|
+
new_file_data = file_data.insert(-6, "\n mount GraphqlPlayground::Rails::Engine, at: '/graphiql_admin', graphql_path: 'api/admin/graphql', as: :admin_graphiql\n post 'api/admin/graphql', to: 'admin_graphql#execute'")
|
54
53
|
File.write(file, new_file_data)
|
55
54
|
p 'Write to routes.rb successfully'
|
56
55
|
else
|
@@ -59,7 +58,6 @@ module GraphqlScaffold
|
|
59
58
|
end
|
60
59
|
|
61
60
|
def add_gem_dependencies
|
62
|
-
|
63
61
|
route_file_path = 'Gemfile'
|
64
62
|
|
65
63
|
p 'Gemfile does not exist' unless File.exist?(route_file_path)
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Comment
|
1
4
|
class AdminGraphqlController < ApplicationController
|
2
5
|
include GraphqlDevise::Concerns::SetUserByToken
|
3
6
|
|
@@ -51,6 +54,7 @@ class AdminGraphqlController < ApplicationController
|
|
51
54
|
logger.error err.message
|
52
55
|
logger.error err.backtrace.join("\n")
|
53
56
|
|
54
|
-
render json: { errors: [{ message: err.message, backtrace: err.backtrace }], data: {} },
|
57
|
+
render json: { errors: [{ message: err.message, backtrace: err.backtrace }], data: {} },
|
58
|
+
status: :internal_server_error
|
55
59
|
end
|
56
|
-
end
|
60
|
+
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Comment
|
1
4
|
class <%= class_name %>AdminSchema < GraphQL::Schema
|
2
5
|
use GraphQL::Tracing::NewRelicTracing, set_transaction_name: true
|
3
6
|
use GraphqlDevise::SchemaPlugin.new(
|
4
|
-
query:
|
5
|
-
mutation:
|
7
|
+
query: Types::Query::AdminUserQueryType,
|
8
|
+
mutation: Types::Mutation::AdminUserMutationType,
|
6
9
|
resource_loaders: [
|
7
10
|
GraphqlDevise::ResourceLoader.new(AdminUser, only: %i[login logout])
|
8
11
|
]
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Comment
|
1
4
|
module Mutations
|
2
5
|
module Admin
|
3
6
|
class <%= class_name %>s::Create<%= class_name %> < BaseAdminMutation
|
4
|
-
|
5
7
|
type Types::Admin::<%= class_name %>Type
|
6
8
|
|
7
9
|
def resolve(**args)
|
8
|
-
|
10
|
+
<%= class_name.underscore %> = <%= class_name %>.new(args)
|
9
11
|
if <%= class_name.underscore %>.save
|
10
|
-
|
12
|
+
<%= class_name.underscore %>
|
11
13
|
else
|
12
|
-
context.add_error(GraphQL::ExecutionError.new(
|
14
|
+
context.add_error(GraphQL::ExecutionError.new(<%= class_name.underscore %>.errors.full_messages.join(', ')))
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails_helper'
|
2
4
|
|
3
5
|
RSpec.describe Mutations::Admin::<%= class_name %>s::Create<%= class_name %>, type: :request do
|
@@ -29,4 +31,4 @@ RSpec.describe Mutations::Admin::<%= class_name %>s::Create<%= class_name %>, ty
|
|
29
31
|
}
|
30
32
|
GQL
|
31
33
|
end
|
32
|
-
end
|
34
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails_helper'
|
2
4
|
|
3
5
|
RSpec.describe Mutations::Admin::<%= class_name %>s::Delete<%= class_name %>, type: :request do
|
@@ -34,4 +36,4 @@ RSpec.describe Mutations::Admin::<%= class_name %>s::Delete<%= class_name %>, ty
|
|
34
36
|
}
|
35
37
|
GQL
|
36
38
|
end
|
37
|
-
end
|
39
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'rails_helper'
|
3
4
|
RSpec.describe Mutations::<%= class_name %>, type: :request do
|
4
|
-
|
5
5
|
describe 'resolve' do
|
6
6
|
|
7
7
|
end
|
@@ -9,8 +9,7 @@ RSpec.describe Mutations::<%= class_name %>, type: :request do
|
|
9
9
|
def query(**args)
|
10
10
|
<<~GQL
|
11
11
|
mutation <%= class_name.underscore %>{
|
12
|
-
<%= class_name.underscore %>{
|
13
|
-
|
12
|
+
<%= class_name.underscore %>{
|
14
13
|
}
|
15
14
|
}
|
16
15
|
GQL
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails_helper'
|
2
4
|
|
3
5
|
RSpec.describe Mutations::Admin::<%= class_name %>s::Update<%= class_name %>, type: :request do
|
@@ -32,4 +34,4 @@ RSpec.describe Mutations::Admin::<%= class_name %>s::Update<%= class_name %>, ty
|
|
32
34
|
}
|
33
35
|
GQL
|
34
36
|
end
|
35
|
-
end
|
37
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails_helper'
|
2
4
|
|
3
5
|
RSpec.describe Resolvers::<%= class_name %>, type: :request do
|
@@ -11,7 +13,6 @@ RSpec.describe Resolvers::<%= class_name %>, type: :request do
|
|
11
13
|
|
12
14
|
describe '#resolve' do
|
13
15
|
it 'pass' do
|
14
|
-
|
15
16
|
end
|
16
17
|
end
|
17
|
-
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_scaffold_fan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fan Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|