hq-graphql 1.1.0 → 1.1.1

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
  SHA1:
3
- metadata.gz: aa14b61d384dece960be3b49e3ebae1405d36fbf
4
- data.tar.gz: aeb81df536b57a6e9477c0d1d7ddadb25e395687
3
+ metadata.gz: 13d8a60ff262b288fd5918633fc2db7450620e2b
4
+ data.tar.gz: 611a0ae3cea59bc3318339dc4d06d9c6370ccbde
5
5
  SHA512:
6
- metadata.gz: 51693b229e820257b9d1814d500a009e3e010ec5bce8a7b530d56296c31c0872b6b9e1f012d6234bb4a516da59854ef06e63123272cb37e51e02a960ca7024db
7
- data.tar.gz: b454283ef63f2fc698aa3990a8fe7c1547cc0aa99cfdfc769b2e23d7d864791031054d9261c050d2cdd6feaef8e24a41f875a934e154a9d2a91579365289c8f3
6
+ metadata.gz: 4ac1a7aee6c9eb6df449258dfc71624900fee0e70d6c50f8d57596acf6a9b76ce7a81da4ab26aaa7d6b1bd3bc104402c5deff3630821a193a74a040f45ef2757
7
+ data.tar.gz: f78cee42cdece49c7211ceec67ac576438eb9bc4e707d9dbb9d6deab6f0835f88ee954cf25f8d8b7b875e29b9126b1aa0adbad8c30b78c702c2ef6d7234e0b8b
@@ -16,6 +16,8 @@ module HQ
16
16
  case column&.cast_type&.type
17
17
  when :uuid
18
18
  ::HQ::GraphQL::Types::UUID
19
+ when :json, :jsonb
20
+ ::HQ::GraphQL::Types::Object
19
21
  when :integer
20
22
  ::GraphQL::Types::Int
21
23
  when :decimal
@@ -1,5 +1,5 @@
1
1
  module HQ
2
2
  module GraphQL
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ class TestType < ::ActiveRecord::Base; end
@@ -18,4 +18,13 @@ ActiveRecord::Schema.define do
18
18
  t.timestamps null: false
19
19
  end
20
20
 
21
+ create_table "test_types", force: true, id: :uuid do |t|
22
+ t.jsonb :data_jsonb
23
+ t.json :data_json
24
+ t.integer :count
25
+ t.decimal :amount
26
+ t.boolean :is_bool
27
+ t.string :name
28
+ end
29
+
21
30
  end
@@ -37,4 +37,50 @@ describe ::HQ::GraphQL::Types do
37
37
  end
38
38
  end
39
39
 
40
+ describe ".type_from_column" do
41
+ context "UUID" do
42
+ it "matches uuid" do
43
+ expect(type_from_column("id")).to eq ::HQ::GraphQL::Types::UUID
44
+ end
45
+ end
46
+
47
+ context "Object" do
48
+ it "matches json" do
49
+ expect(type_from_column("data_json")).to eq ::HQ::GraphQL::Types::Object
50
+ end
51
+
52
+ it "matches jsonb" do
53
+ expect(type_from_column("data_jsonb")).to eq ::HQ::GraphQL::Types::Object
54
+ end
55
+ end
56
+
57
+ context "Int" do
58
+ it "matches integer" do
59
+ expect(type_from_column("count")).to eq ::GraphQL::Types::Int
60
+ end
61
+ end
62
+
63
+ context "Float" do
64
+ it "matches decimal" do
65
+ expect(type_from_column("amount")).to eq ::GraphQL::Types::Float
66
+ end
67
+ end
68
+
69
+ context "Boolean" do
70
+ it "matches boolean" do
71
+ expect(type_from_column("is_bool")).to eq ::GraphQL::Types::Boolean
72
+ end
73
+ end
74
+
75
+ context "String" do
76
+ it "matches string" do
77
+ expect(type_from_column("name")).to eq ::GraphQL::Types::String
78
+ end
79
+ end
80
+
81
+ def type_from_column(name)
82
+ described_class.type_from_column(TestType.columns_hash[name])
83
+ end
84
+ end
85
+
40
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hq-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Jones
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2018-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -116,6 +116,7 @@ files:
116
116
  - spec/factories/users.rb
117
117
  - spec/internal/app/models/advisor.rb
118
118
  - spec/internal/app/models/organization.rb
119
+ - spec/internal/app/models/test_type.rb
119
120
  - spec/internal/app/models/user.rb
120
121
  - spec/internal/config/database.circleci.yml
121
122
  - spec/internal/config/database.yml
@@ -158,6 +159,7 @@ test_files:
158
159
  - spec/spec_helper.rb
159
160
  - spec/internal/app/models/advisor.rb
160
161
  - spec/internal/app/models/organization.rb
162
+ - spec/internal/app/models/test_type.rb
161
163
  - spec/internal/app/models/user.rb
162
164
  - spec/internal/config/database.circleci.yml
163
165
  - spec/internal/config/database.yml