graphql_scaffold_fan 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00fb9e47f055bb4553d193ea6527cc4a5168b711cbf2e8567d5ab8b79fcff526
4
- data.tar.gz: dd7cfda4ab899da2d4246a229bdbf2ff6a3d57194daecf0a65056291e53096e1
3
+ metadata.gz: 1ca0c115c610c53ece69712300c30d7b6a4b8d604360e1ff12983c5efb58bd5c
4
+ data.tar.gz: 2238a18b5a643e5ae89b31bcc08e44aad0965caedd145d6e72210ebf34c0250a
5
5
  SHA512:
6
- metadata.gz: a153c02f23d249c3f9145d497b572cb68ac6460b77c98908213a4eddca3c991125d2f0e0602b5331e93bda301967b593b5514a085dc2202284c183bdbda6e991
7
- data.tar.gz: dd5d943dfa1d47fc0f2177efff3c58fbac0ee722a90de4d46e0048847dc149742ee7f0cd03b456e88fe1e042b7ace3f5b4433612abd6ffdf8492bf9d142f301b
6
+ metadata.gz: 73ce30b9e17ae0d95728e73f46b03eb5470123ad1d85c58de2a7a13a03a28123fc45ae2a7698140f01da4aa93473b4e1fd7a272dd164b3a1eb7752c831c28175
7
+ data.tar.gz: cfc8defe9cf83b6a6aa3a8d7d509fbf316c3c8f6d6f2cddac45b7b359124d5fa19e8b702de67dab3c6334b622ec28646f31936e256bbe1e70850734c16d32981
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_scaffold_fan (0.1.5)
4
+ graphql_scaffold_fan (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -29,6 +29,12 @@ Example commands:
29
29
  `rails generate graphql_scaffold:mutation <MutationName>`
30
30
  `rails generate graphql_scaffold:type <TypeName>`
31
31
 
32
+ If you ever found mutation not loading in schema: pls check the following code
33
+ `config.load_defaults 6.1`
34
+ `# config.autoloader = :zeitwerk`
35
+ Reference link:
36
+ https://guides.rubyonrails.org/classic_to_zeitwerk_howto.html
37
+
32
38
 
33
39
  ## Development
34
40
 
@@ -30,7 +30,6 @@ module GraphqlScaffold
30
30
  end
31
31
 
32
32
  def create_admin_controller_file
33
- @top_folder_name = File.basename(Dir.getwd)
34
33
  dir_path = 'app/controllers'
35
34
  file_path = dir_path + '/admin_graphql_controller.rb'
36
35
  FileUtils.mkdir_p(dir_path) unless File.exist?(dir_path)
@@ -7,7 +7,6 @@ class AdminGraphqlController < ApplicationController
7
7
  # This allows for outside API access while preventing CSRF attacks,
8
8
  # but you'll have to authenticate your user separately
9
9
  protect_from_forgery with: :null_session
10
- after_action :track_action
11
10
 
12
11
  def execute
13
12
  variables = prepare_variables(params[:variables])
@@ -18,7 +17,7 @@ class AdminGraphqlController < ApplicationController
18
17
 
19
18
  @current_resource = context[:current_resource]
20
19
 
21
- result = <%= @top_folder_name.camelize %>AdminSchema.execute(query, variables: variables, context: context, operation_name: operation_name)
20
+ result = <%= class_name %>AdminSchema.execute(query, variables: variables, context: context, operation_name: operation_name)
22
21
  render json: result
23
22
  rescue StandardError => e
24
23
  raise e unless Rails.env.development?
@@ -54,11 +53,4 @@ class AdminGraphqlController < ApplicationController
54
53
 
55
54
  render json: { errors: [{ message: err.message, backtrace: err.backtrace }], data: {} }, status: :internal_server_error
56
55
  end
57
-
58
- def track_action
59
- variables = prepare_variables(params[:variables])
60
- query = params[:query]
61
- operation_name = params[:operationName]
62
- ahoy.track 'Admin Portal', query: query, variables: variables, operation_name: operation_name
63
- end
64
56
  end
@@ -1,4 +1,4 @@
1
- class <%= @top_folder_name.camelize %>AdminSchema < GraphQL::Schema
1
+ class <%= class_name %>AdminSchema < GraphQL::Schema
2
2
  use GraphQL::Tracing::NewRelicTracing, set_transaction_name: true
3
3
  use GraphqlDevise::SchemaPlugin.new(
4
4
  query: Types::Query::AdminUserQueryType,
@@ -6,7 +6,7 @@ module Mutations
6
6
 
7
7
  def resolve(**args)
8
8
  <%= class_name.underscore %> = <%= class_name %>.new(args)
9
- if <%= class_name.underscore %>.save
9
+ if <%= class_name.underscore %>.save
10
10
  <%= class_name.underscore %>
11
11
  else
12
12
  context.add_error(GraphQL::ExecutionError.new( <%= class_name.underscore %>.errors.full_messages.join(', ')))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlScaffoldFan
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
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.1.5
4
+ version: 0.1.6
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-06-28 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Helping creating graphql files
14
14
  email: