graphql-rails-api 0.7.5 → 0.8.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 529885203fa8337d28c94ac45e07cedc82c9393dc671c1dca5ab2880c3904013
|
4
|
+
data.tar.gz: 214d0d3c85fb42b6d1a7e50cbe3214f169a71240cd3df9fde43120a71c9d826e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d2d9873c382edee93417c8dbb63265c08594b98f1461f3b35de18518c12584f568d5c6fad6d30f0e4f067d2e119a66d588d13b99302043bc460c7a22d8236e
|
7
|
+
data.tar.gz: 8804df58777ba615ece39a245a72457ea0a52db7d22a99411e7c02abfa3de97fd63f60f1d9ecf6f1d3d9fdcf8e464e7c5e6e0e415c3de1ad010cf149687a93e1
|
@@ -16,6 +16,7 @@ module GraphqlRailsApi
|
|
16
16
|
write_schema
|
17
17
|
write_query_type
|
18
18
|
write_mutation_type
|
19
|
+
write_collection_ids_resolver
|
19
20
|
|
20
21
|
write_controller
|
21
22
|
|
@@ -52,6 +53,25 @@ module GraphqlRailsApi
|
|
52
53
|
)
|
53
54
|
end
|
54
55
|
|
56
|
+
def write_collection_ids_resolver
|
57
|
+
File.write(
|
58
|
+
'app/graphql/collection_ids_resolver.rb',
|
59
|
+
<<~STRING
|
60
|
+
class CollectionIdsResolver
|
61
|
+
|
62
|
+
def self.call(obj, _args, ctx)
|
63
|
+
if obj.is_a?(OpenStruct)
|
64
|
+
obj[ctx.field.name.gsub('_ids', '').pluralize]&.map(&:id)
|
65
|
+
else
|
66
|
+
obj.send(ctx.field.name)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
STRING
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
55
75
|
def write_application_record_methods
|
56
76
|
lines_count = File.read('app/models/application_record.rb').lines.count
|
57
77
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-rails-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poilon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|