souls 0.65.1 → 0.65.5

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: 8f8176d143c89bdaa40a3a3526d94eae4ec4c5d690e8e6284388a0aceb568a40
4
- data.tar.gz: 5e1fd6e6dbb61780bdde190dc69ef6f577450dddc9bbf9a3b3f11049622969e4
3
+ metadata.gz: 2189748c3d80909f1e0281373e2016c8b6d0ee25a40b0db9f3d7d487d2fc7d11
4
+ data.tar.gz: 1ef32917dd90e7a9b41c65e9d1c176a131f786a118757f66202e7990c571f1b9
5
5
  SHA512:
6
- metadata.gz: fd18ce063b90f06cb385c2fa5da8fb9b1fcc64908f6ad5aa8831238bd6fcb2f14cb0f56fa03003ad2756067efdf6ed5e4be3dcdf9c5e481eb6a6d4eb3b870867
7
- data.tar.gz: df23195180ebb2b4ce50018f7662dc400ad328eb741788e3a80461f4e44149c66258530ae093e602ac9d666f6e2a09bc66023239a1f509ae55e34719ad717c5a
6
+ metadata.gz: 587fdae00e9252f6862712b4da67bc3bbfd848b928caaa28a2508cf3c08a0e3d7214762487718263675831e5f331624a757eadd5489765bb0e222c13fcf77974
7
+ data.tar.gz: 15407243da04231cd9841287f774a005029067fd5c4a364aa17f297a10e3dd373e713a6cfc3d71130aa7e351a09ba807af7b1ffb419a3f594f926721f2f5a304
@@ -45,6 +45,8 @@ module Souls
45
45
  type = Souls.type_check(param[:type])
46
46
  type = "[#{type}]" if param[:array]
47
47
  type = "String" if param[:column_name].match?(/$*_id\z/)
48
+ next if param[:column_name] == "user_id"
49
+
48
50
  if i == params[:params].size - 1
49
51
  f.write(" argument :#{param[:column_name]}, #{type}, required: false\n\n")
50
52
  f.write(" def resolve(args)\n")
@@ -105,6 +107,7 @@ module Souls
105
107
  field :#{singularized_class_name}_edge, Types::#{singularized_class_name.camelize}Type.edge_type, null: false
106
108
  field :error, String, null: true
107
109
 
110
+ argument :id, String, required: true
108
111
  TEXT
109
112
  end
110
113
 
@@ -113,9 +116,12 @@ module Souls
113
116
  type = Souls.type_check(param[:type])
114
117
  type = "[#{type}]" if param[:array]
115
118
  type = "String" if param[:column_name].match?(/$*_id\z/)
119
+ next if param[:column_name] == "user_id"
120
+
116
121
  if i == params[:params].size - 1
117
122
  f.write(" argument :#{param[:column_name]}, #{type}, required: false\n\n")
118
123
  f.write(" def resolve(args)\n")
124
+ f.write(" _, data_id = SoulsApiSchema.from_global_id(args[:id])\n")
119
125
  else
120
126
  f.write(" argument :#{param[:column_name]}, #{type}, required: false\n")
121
127
  end
@@ -135,12 +141,11 @@ module Souls
135
141
  ", #{n[:column_name]}: #{n[:column_name]}"
136
142
  end
137
143
  f.write(" new_record = { **args #{relation_params.compact.join} }\n")
138
- f.write(" data = ::#{singularized_class_name.camelize}.find(article_id)\n")
139
- f.write(" data.update(new_record)\n")
140
144
  else
141
- f.write(" data = ::#{singularized_class_name.camelize}.find(article_id)\n")
142
- f.write(" data.update(args)\n")
145
+ f.write(" new_record = args.except(:id)\n")
143
146
  end
147
+ f.write(" data = ::#{singularized_class_name.camelize}.find(data_id)\n")
148
+ f.write(" data.update(new_record)\n")
144
149
  end
145
150
  File.open(file_path, "a") do |new_line|
146
151
  new_line.write(<<~TEXT)
@@ -43,7 +43,7 @@ module Souls
43
43
  if i == params[:params].size - 1
44
44
  f.write(" #{param[:column_name]}: #{type}?\n")
45
45
  elsif param[:column_name].match?(/$*_id\z/)
46
- f.write(" #{param[:column_name]}: String?\n")
46
+ f.write(" #{param[:column_name]}: String?,\n")
47
47
  else
48
48
  f.write(" #{param[:column_name]}: #{type}?,\n")
49
49
  end
@@ -61,7 +61,11 @@ module Souls
61
61
  rbs_type = Souls.rbs_type_check(param[:type])
62
62
  type = "[#{type}]" if param[:array]
63
63
  if i.zero?
64
- f.write(" def self.argument: (:#{param[:column_name]}, #{type}, required: false ) -> #{rbs_type}\n")
64
+ if param[:column_name].match?(/$*_id\z/)
65
+ f.write(" def self.argument: (:#{param[:column_name]}, String, required: false ) -> #{rbs_type}\n")
66
+ else
67
+ f.write(" def self.argument: (:#{param[:column_name]}, #{type}, required: false ) -> #{rbs_type}\n")
68
+ end
65
69
  elsif param[:column_name].match?(/$*_id\z/)
66
70
  f.write(" | (:#{param[:column_name]}, String, required: false ) -> String\n")
67
71
  else
@@ -117,6 +121,8 @@ module Souls
117
121
  params[:params].each_with_index do |param, i|
118
122
  type = Souls.rbs_type_check(param[:type])
119
123
  type = "[#{type}]" if param[:array]
124
+ next if param[:column_name] == "user_id"
125
+
120
126
  if i == params[:params].size - 1
121
127
  f.write(" #{param[:column_name]}: #{type}?\n")
122
128
  else
@@ -135,9 +141,16 @@ module Souls
135
141
  type = Souls.type_check(param[:type])
136
142
  rbs_type = Souls.rbs_type_check(param[:type])
137
143
  type = "[#{type}]" if param[:array]
144
+ next if param[:column_name] == "user_id"
145
+
138
146
  required = param[:column_name] == "id" ? "required: true" : "required: false"
139
147
  if i.zero?
140
- f.write(" def self.argument: (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
148
+ if param[:column_name].match?(/$*_id\z/)
149
+ f.write(" def self.argument: (:#{param[:column_name]}, String, #{required} ) -> String\n")
150
+ else
151
+ f.write(" def self.argument: (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
152
+ end
153
+
141
154
  else
142
155
  f.write(" | (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
143
156
  end
@@ -25,7 +25,12 @@ module Souls
25
25
  type = "[#{type}]" if param[:array]
26
26
  rbs_type = Souls.rbs_type_check(param[:type])
27
27
  if i.zero?
28
- f.write(" def self.field: (:#{param[:column_name]}, #{type}, null: true) -> #{rbs_type}\n")
28
+ if param[:column_name].match?(/$*_id\z/)
29
+ col_name = param[:column_name].gsub("_id", "")
30
+ f.write(" def self.field: (:#{col_name}, untyped, null: false) -> untyped\n")
31
+ else
32
+ f.write(" def self.field: (:#{param[:column_name]}, #{type}, null: true) -> #{rbs_type}\n")
33
+ end
29
34
  elsif param[:column_name].match?(/$*_id\z/)
30
35
  col_name = param[:column_name].gsub("_id", "")
31
36
  f.write(" | (:#{col_name}, untyped, null: false) -> untyped\n")
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.65.1".freeze
2
+ VERSION = "0.65.5".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.44.1
1
+ 0.44.5
@@ -1 +1 @@
1
- 0.44.1
1
+ 0.44.5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.65.1
4
+ version: 0.65.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI