ibrain-core 0.1.9 → 0.2.0

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: 197d83360e5b4281c1580976c1e5fc56617cfbc62cb19771935c4e1d11eded46
4
- data.tar.gz: 824c0ca8095c991c4ce31dac6e6fbad27ac48f8ab6855bb4165de78bf9cb7b29
3
+ metadata.gz: 1a04fdcab0c02b1f8a8d58a25dae8cd1bda74a4b296e2aeb219861df4464f008
4
+ data.tar.gz: baae07824103dcc3c80ab8228b154009242bca6648f3706ab9d5e18f743c9303
5
5
  SHA512:
6
- metadata.gz: f17faebbf900b04bbd9deb8ac26ba3a92efe935294a97bdf045f39fbd168d5a5db00638d24b01663124dc710329454453c37631d7983a86b629f48b105daf475
7
- data.tar.gz: d91616aa9dc3eba73f3a9a21dba11a5eea20cfec45abc17e0e47e0254678ecf1b7ab5df53e109b49e1502a57eaf889f32a88e4136e2582e997d14b08506d988d
6
+ metadata.gz: 4e1d2b42216cdffccbc7e5b1b103f9370c5dc8486a2a30ee5a902295a72c5d606e23881d110bb63715e105c2270834515c931ad49abbd6888437cf34ec97dda3
7
+ data.tar.gz: cdbc90d0ddaed7d02d76ad69061e84cbd7bc4b6dcfaf82ce4035f994189fbeece3c5452098393e4efdf85a4700b120ed1df8d25fea612fdcd4ce93b2e0b47694
data/README.md CHANGED
@@ -54,20 +54,34 @@ bundle exec rails generate ibrain:graphql:resolvers users --model=User
54
54
  For pagination please using aggregate body query, something like
55
55
  ```
56
56
  query users($offset: Int, $limit: Int, $filter: Filter) {
57
- users(offset: $offset, limit: $limit, filter: $filter) {
58
- id
59
- first_name
60
- }
57
+ users(offset: $offset, limit: $limit, filter: $filter) {
58
+ id
59
+ first_name
60
+ }
61
61
 
62
- users_aggregate(filter: $filter) {
63
- total_count
64
- }
62
+ users_aggregate(filter: $filter) {
63
+ total_count
64
+ }
65
65
  }
66
66
  ```
67
67
  To generate graphql mutation to insert, update, delete user
68
68
  ```bash
69
69
  bundle exec rails generate ibrain:graphql:mutation insert_user --model=User
70
70
  ```
71
+
72
+ Default all operation will be rejected if you not have Authorization Token at request header, so to skip authenticate please change `parent_controller` at `ibrain.rb`
73
+ ```
74
+ config.parent_controller = "<Your parent controller>"
75
+ ```
76
+ then create method skip_operations at this parent_controller
77
+ ```
78
+ class ApplicationController < BaseController::API
79
+ def skip_operations
80
+ %w[sign_in].include?(operation_name)
81
+ end
82
+ end
83
+ ```
84
+
71
85
  ## Contributing
72
86
  Contribution directions go here.
73
87
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibrain
4
- class BaseController < ActionController::API
4
+ class BaseController < Ibrain::Config.parent_controller.constantize
5
5
  include ActionController::Helpers
6
6
  include Ibrain::Core::ControllerHelpers::Response
7
7
  include Ibrain::Core::ControllerHelpers::StrongParameters
@@ -18,7 +18,7 @@ module Ibrain
18
18
  end
19
19
 
20
20
  def skip_operations
21
- %w[sign_in].include?(operation_name)
21
+ super || ['IntrospectionQuery'].include?(operation_name)
22
22
  end
23
23
 
24
24
  def cryptor
@@ -7,7 +7,7 @@ module Resolvers
7
7
  # description
8
8
 
9
9
  # TODO: define return fields
10
- type Types::Objects::<%= model_name.capitalize %>Type, null: false, description: 'Define data type will be response to client'
10
+ type Types::Objects::<%= model_name.capitalize %>Type, null: false
11
11
 
12
12
  argument :id, ID, required: false, description: 'TODO: describe about this argument'
13
13
 
@@ -7,7 +7,7 @@ module Resolvers
7
7
  # description
8
8
 
9
9
  # TODO: define return fields
10
- type [Types::Objects::<%= model_name.capitalize %>Type], null: false, description: 'Define data type will be response to client'
10
+ type [Types::Objects::<%= model_name.capitalize %>Type], null: false
11
11
 
12
12
  # TODO: define resolve method
13
13
  def resolve(args)
@@ -41,6 +41,9 @@ Ibrain.config do |config|
41
41
 
42
42
  # Graphql Encryptor key
43
43
  # config.ibrain_encryptor_key = Rails.application.secrets.secret_key_base.byteslice(0..31)
44
+
45
+ # Parent controller
46
+ # config.parent_controller = 'ActionController::API'
44
47
  end
45
48
 
46
49
  <% if defined?(Ibrain::Api::Engine) -%>
@@ -48,6 +48,9 @@ module Ibrain
48
48
  # Graphql Encryptor key
49
49
  preference :ibrain_encryptor_key, :string, default: nil
50
50
 
51
+ # Parent controller
52
+ preference :parent_controller, :string, default: 'ActionController::API'
53
+
51
54
  def static_model_preferences
52
55
  @static_model_preferences ||= Ibrain::Preferences::StaticModelPreferences.new
53
56
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibrain
4
- VERSION = "0.1.9"
4
+ VERSION = "0.2.0"
5
5
 
6
6
  def self.ibrain_version
7
7
  VERSION
8
8
  end
9
9
 
10
10
  def self.previous_ibrain_minor_version
11
- '0.1.8'
11
+ '0.1.9'
12
12
  end
13
13
 
14
14
  def self.ibrain_gem_version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibrain-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tai Nguyen Van