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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5d1ca8a0189f63ad24ce0019951498fd7ca52cece5e315ab891ae45a4644a9c
4
- data.tar.gz: f5c422b16830b29a6c53c78a826f884fd4f94f5cbc621431394b63b4d9bf07fd
3
+ metadata.gz: 6fd748283918d5930f5362003773250fee8431e809120a3cbef546662110b404
4
+ data.tar.gz: 533cc9e4867e83c327da5b3121d9a111f289670a185a0ef8cb5352aa3ceb63e8
5
5
  SHA512:
6
- metadata.gz: 1cd7db1267f68770cea00fdaa8c50f92dbae8238f5acca3f12abd190766dafb63f4c342d684324586d2616a8ef500d57bc8943ddf635c8156578c8907a914cb4
7
- data.tar.gz: 2b1e7e7eab3ef3c1cc39e3e8c47b0210bb537c9c0d46f71ceef3c337e3d69526c0303e4dd809d44fe984308ddc6ad38a3a360c36ed76f41a09e61bdc9d33bf74
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.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.11)
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.7-x86_64-darwin)
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.4)
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 + "/#{@top_folder_name.underscore}_admin_schema.rb"
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 #{@top_folder_name}_admin_schema.rb already exists"
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: 'graphql_admin#execute'")
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: {} }, status: :internal_server_error
57
+ render json: { errors: [{ message: err.message, backtrace: err.backtrace }], data: {} },
58
+ status: :internal_server_error
55
59
  end
56
- end
60
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Types
2
4
  module Inputs
3
5
  module Admin
@@ -14,4 +16,4 @@ module Types
14
16
  end
15
17
  end
16
18
  end
17
- end
19
+ 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: Types::Query::AdminUserQueryType,
5
- mutation: Types::Mutation::AdminUserMutationType,
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,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Mutations
2
4
  class BaseAdminMutation < GraphQL::Schema::Mutation
3
5
  end
4
- end
6
+ end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Types
2
4
  class BaseObject < GraphQL::Schema::Object
3
-
4
5
  def self.has_admin_fields(attach_sttr, **conf)
5
6
  attach_sttr = attach_sttr.to_s
6
7
  get_one = attach_sttr
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Types
2
4
  module Admin
3
5
  class ListMetadataType < Types::BaseObject
@@ -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
- <%= class_name.underscore %> = <%= class_name %>.new(args)
10
+ <%= class_name.underscore %> = <%= class_name %>.new(args)
9
11
  if <%= class_name.underscore %>.save
10
- <%= class_name.underscore %>
12
+ <%= class_name.underscore %>
11
13
  else
12
- context.add_error(GraphQL::ExecutionError.new( <%= class_name.underscore %>.errors.full_messages.join(', ')))
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,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Comment
1
4
  module Mutations
2
5
  module Admin
3
6
  class <%= class_name %>s::Delete<%= class_name %> < BaseAdminMutation
4
-
5
7
  type Types::Admin::<%= class_name %>Type
6
8
 
7
9
  def resolve(id:)
@@ -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
- require 'rails_helper'
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,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Types
2
4
  module Admin
3
5
  class MutationType < Types::BaseObject
4
-
5
6
  has_admin_mutation :<%= class_name %>
6
7
  end
7
8
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Comment
1
4
  module Mutations
2
5
  module Admin
3
6
  class <%= class_name %>s::Update<%= class_name %> < BaseAdminMutation
@@ -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
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Types
2
4
  module Admin
3
5
  class QueryType < Types::BaseObject
4
-
5
6
  has_admin_fields :<%= class_name %>
6
7
  end
7
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlScaffoldFan
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.5'
5
5
  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.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-18 00:00:00.000000000 Z
11
+ date: 2022-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql