souls 0.22.3 → 0.22.7

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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +6 -3
  4. data/exe/souls +27 -6
  5. data/hoy/.env.sample +7 -0
  6. data/hoy/.gitignore +32 -0
  7. data/hoy/.irbrc +1 -0
  8. data/hoy/.rspec +3 -0
  9. data/hoy/.rubocop.yml +132 -0
  10. data/hoy/.ruby-version +1 -0
  11. data/hoy/CODE_OF_CONDUCT.md +74 -0
  12. data/hoy/Dockerfile +16 -0
  13. data/hoy/Dockerfile.dev +17 -0
  14. data/hoy/Gemfile +50 -0
  15. data/hoy/Gemfile.lock +407 -0
  16. data/hoy/LICENSE.txt +67 -0
  17. data/hoy/Procfile +2 -0
  18. data/hoy/Procfile.dev +2 -0
  19. data/hoy/README.md +61 -0
  20. data/hoy/Rakefile +5 -0
  21. data/hoy/app.rb +116 -0
  22. data/hoy/app/graphql/mutations/.keep +0 -0
  23. data/hoy/app/graphql/mutations/base/article/create_article.rb +30 -0
  24. data/hoy/app/graphql/mutations/base/article/delete_article.rb +17 -0
  25. data/hoy/app/graphql/mutations/base/article/destroy_delete_article.rb +17 -0
  26. data/hoy/app/graphql/mutations/base/article/update_article.rb +30 -0
  27. data/hoy/app/graphql/mutations/base/article_category/create_article_category.rb +21 -0
  28. data/hoy/app/graphql/mutations/base/article_category/delete_article_category.rb +17 -0
  29. data/hoy/app/graphql/mutations/base/article_category/destroy_delete_article_category.rb +17 -0
  30. data/hoy/app/graphql/mutations/base/article_category/update_article_category.rb +21 -0
  31. data/hoy/app/graphql/mutations/base/user/create_user.rb +31 -0
  32. data/hoy/app/graphql/mutations/base/user/delete_user.rb +17 -0
  33. data/hoy/app/graphql/mutations/base/user/destroy_delete_user.rb +17 -0
  34. data/hoy/app/graphql/mutations/base/user/update_user.rb +31 -0
  35. data/hoy/app/graphql/mutations/base_mutation.rb +33 -0
  36. data/hoy/app/graphql/mutations/user_manager/add_user_role.rb +22 -0
  37. data/hoy/app/graphql/mutations/user_manager/remove_user_role.rb +22 -0
  38. data/hoy/app/graphql/mutations/user_manager/sign_in_user.rb +45 -0
  39. data/hoy/app/graphql/queries/article.rb +13 -0
  40. data/hoy/app/graphql/queries/article_categories.rb +11 -0
  41. data/hoy/app/graphql/queries/article_category.rb +13 -0
  42. data/hoy/app/graphql/queries/articles.rb +11 -0
  43. data/hoy/app/graphql/queries/base_query.rb +9 -0
  44. data/hoy/app/graphql/queries/me.rb +11 -0
  45. data/hoy/app/graphql/queries/user.rb +13 -0
  46. data/hoy/app/graphql/queries/users.rb +11 -0
  47. data/hoy/app/graphql/resolvers/article_category_search.rb +41 -0
  48. data/hoy/app/graphql/resolvers/article_search.rb +57 -0
  49. data/hoy/app/graphql/resolvers/base.rb +17 -0
  50. data/hoy/app/graphql/resolvers/user_search.rb +63 -0
  51. data/hoy/app/graphql/souls_api_schema.rb +43 -0
  52. data/hoy/app/graphql/types/.keep +0 -0
  53. data/hoy/app/graphql/types/article_category_type.rb +12 -0
  54. data/hoy/app/graphql/types/article_type.rb +30 -0
  55. data/hoy/app/graphql/types/base/base_argument.rb +4 -0
  56. data/hoy/app/graphql/types/base/base_enum.rb +4 -0
  57. data/hoy/app/graphql/types/base/base_field.rb +5 -0
  58. data/hoy/app/graphql/types/base/base_input_object.rb +5 -0
  59. data/hoy/app/graphql/types/base/base_interface.rb +7 -0
  60. data/hoy/app/graphql/types/base/base_object.rb +6 -0
  61. data/hoy/app/graphql/types/base/base_scalar.rb +4 -0
  62. data/hoy/app/graphql/types/base/base_union.rb +4 -0
  63. data/hoy/app/graphql/types/base/mutation_type.rb +16 -0
  64. data/hoy/app/graphql/types/base/query_type.rb +18 -0
  65. data/hoy/app/graphql/types/connections/article_category_connection.rb +3 -0
  66. data/hoy/app/graphql/types/connections/article_connection.rb +3 -0
  67. data/hoy/app/graphql/types/connections/base_connection.rb +14 -0
  68. data/hoy/app/graphql/types/connections/user_connection.rb +3 -0
  69. data/hoy/app/graphql/types/edges/article_category_edge.rb +5 -0
  70. data/hoy/app/graphql/types/edges/article_edge.rb +5 -0
  71. data/hoy/app/graphql/types/edges/base_edge.rb +4 -0
  72. data/hoy/app/graphql/types/edges/user_edge.rb +5 -0
  73. data/hoy/app/graphql/types/user_type.rb +22 -0
  74. data/hoy/app/models/article.rb +4 -0
  75. data/hoy/app/models/article_category.rb +3 -0
  76. data/hoy/app/models/user.rb +19 -0
  77. data/hoy/app/policies/application_policy.rb +40 -0
  78. data/hoy/app/policies/article_category_policy.rb +31 -0
  79. data/hoy/app/policies/article_policy.rb +31 -0
  80. data/hoy/app/policies/user_policy.rb +35 -0
  81. data/hoy/app/utils/association_loader.rb +50 -0
  82. data/hoy/app/utils/firebase_id_token.rb +4 -0
  83. data/hoy/app/utils/json_web_token.rb +13 -0
  84. data/hoy/app/utils/record_loader.rb +10 -0
  85. data/hoy/app/utils/souls_helper.rb +96 -0
  86. data/hoy/cloudbuild.yml +32 -0
  87. data/hoy/config.ru +17 -0
  88. data/hoy/config/database.yml +33 -0
  89. data/hoy/config/souls.rb +4 -0
  90. data/hoy/constants/areas.rb +71 -0
  91. data/hoy/constants/column_name_ja.rb +27 -0
  92. data/hoy/db/migrate/20200006095538_create_users.rb +30 -0
  93. data/hoy/db/migrate/20200712180236_create_article_categories.rb +12 -0
  94. data/hoy/db/migrate/20200714215521_create_articles.rb +22 -0
  95. data/hoy/db/schema.rb +78 -0
  96. data/hoy/db/seeds.rb +44 -0
  97. data/hoy/github/workflows/delivery.yml +81 -0
  98. data/hoy/log/.keep +0 -0
  99. data/hoy/spec/factories/article_categories.rb +9 -0
  100. data/hoy/spec/factories/articles.rb +17 -0
  101. data/hoy/spec/factories/users.rb +23 -0
  102. data/hoy/spec/models/article_category_spec.rb +7 -0
  103. data/hoy/spec/models/article_spec.rb +7 -0
  104. data/hoy/spec/models/user_spec.rb +7 -0
  105. data/hoy/spec/mutations/base/article_category_spec.rb +46 -0
  106. data/hoy/spec/mutations/base/article_spec.rb +70 -0
  107. data/hoy/spec/mutations/base/user_spec.rb +76 -0
  108. data/hoy/spec/policies/article_category_policy_spec.rb +25 -0
  109. data/hoy/spec/policies/article_policy_spec.rb +25 -0
  110. data/hoy/spec/policies/user_policy_spec.rb +5 -0
  111. data/hoy/spec/queries/article_category_spec.rb +39 -0
  112. data/hoy/spec/queries/article_spec.rb +53 -0
  113. data/hoy/spec/queries/user_spec.rb +59 -0
  114. data/hoy/spec/resolvers/article_category_search_spec.rb +54 -0
  115. data/hoy/spec/resolvers/article_search_spec.rb +68 -0
  116. data/hoy/spec/resolvers/user_search_spec.rb +74 -0
  117. data/hoy/spec/spec_helper.rb +110 -0
  118. data/hoy/tmp/.keep +0 -0
  119. data/lib/souls.rb +56 -12
  120. data/lib/souls/generate/mutation.rb +4 -6
  121. data/lib/souls/init.rb +16 -9
  122. data/lib/souls/version.rb +1 -1
  123. metadata +115 -1
data/hoy/Procfile ADDED
@@ -0,0 +1,2 @@
1
+ web: bundle exec puma -p $PORT -e production
2
+ redis: redis-server
data/hoy/Procfile.dev ADDED
@@ -0,0 +1,2 @@
1
+ web: bundle exec puma -p 3000 -e development
2
+ redis: redis-server
data/hoy/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # SOULs Ruby GraphQL API Server
2
+ SOULs Ruby GraphQL API Server Boilerplate
3
+
4
+ <p align="center">
5
+
6
+ <a aria-label="Ruby logo" href="https://el-soul.com">
7
+ <img src="https://badgen.net/badge/icon/Made%20by%20ELSOUL?icon=ruby&label&color=black&labelColor=black">
8
+ </a>
9
+ <br/>
10
+ </p>
11
+
12
+ ## Installation
13
+
14
+ git clone
15
+
16
+ ```
17
+ git clone git@github.com:elsoul/souls_api.git
18
+ cd souls_api
19
+ bundle install
20
+ ```
21
+
22
+
23
+ # Run Server on local
24
+
25
+ ```ruby
26
+ souls s
27
+ ```
28
+
29
+
30
+ ## SOULs Document
31
+
32
+ - [SOULs Document](https://souls-doc.el-soul.com/)
33
+
34
+
35
+
36
+
37
+ You can see GraphQL Playground here;
38
+
39
+ `localhost:3000/playground`
40
+
41
+
42
+
43
+
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org/gems/souls_api).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/elsoul/souls_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
54
+
55
+ ## License
56
+
57
+ The gem is available as open source under the terms of the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
58
+
59
+ ## Code of Conduct
60
+
61
+ Everyone interacting in the HotelPrice project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elsoul/souls_api/blob/master/CODE_OF_CONDUCT.md).
data/hoy/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "./app"
2
+ require "sinatra/activerecord/rake"
3
+ require "graphql/rake_task"
4
+
5
+ GraphQL::RakeTask.new(schema_name: "SoulsApiSchema")
data/hoy/app.rb ADDED
@@ -0,0 +1,116 @@
1
+ require "active_support"
2
+ require "active_support/core_ext"
3
+ require "erb"
4
+ require "jwt"
5
+ require "json"
6
+ require "sinatra"
7
+ require "sinatra/base"
8
+ require "sinatra/json"
9
+ require "psych"
10
+ require "sinatra/activerecord"
11
+ require "rack/contrib"
12
+ require "zeitwerk"
13
+ require "factory_bot"
14
+ require "faker"
15
+ require "dotenv/load"
16
+ require "firebase_id_token"
17
+ require "graphql"
18
+ require "google/cloud/firestore"
19
+ require "google/cloud/storage"
20
+ require "google/cloud/pubsub"
21
+ require "logger"
22
+ require "base64"
23
+ require "slack/ruby3"
24
+ require "role_model"
25
+ require "pundit"
26
+ require "sendgrid-ruby"
27
+ require "search_object"
28
+ require "search_object/plugin/graphql"
29
+ require "graphql/batch"
30
+
31
+ ENV["RACK_ENV"] ||= "development"
32
+ Dir["./config/*.rb"].each { |f| require f unless f.include?("souls.rb") }
33
+ Dir["./constants/*.rb"].each { |f| require f }
34
+
35
+ db_conf = YAML.safe_load(ERB.new(File.read("./config/database.yml")).result, permitted_classes: [Date], aliases: true)
36
+ ActiveRecord::Base.establish_connection(db_conf[ENV["RACK_ENV"]])
37
+ ActiveRecord::Base.default_timezone = :local
38
+
39
+ loader = Zeitwerk::Loader.new
40
+ loader.push_dir("#{Dir.pwd}/app/models")
41
+ loader.push_dir("#{Dir.pwd}/app/utils")
42
+ loader.push_dir("#{Dir.pwd}/app/policies")
43
+
44
+ loader.do_not_eager_load("#{Dir.pwd}/app/services")
45
+ loader.collapse("#{__dir__}/app/types")
46
+ loader.collapse("#{__dir__}/app/mutations")
47
+ loader.collapse("#{__dir__}/app/queries")
48
+ loader.collapse("#{__dir__}/app/services")
49
+ loader.collapse("#{__dir__}/app/resolvers")
50
+ loader.collapse("#{__dir__}/app/graphql/types/connections")
51
+ loader.collapse("#{__dir__}/app/graphql/types/edges")
52
+ loader.collapse("#{__dir__}/app/graphql/types/base")
53
+ loader.push_dir("#{Dir.pwd}/app/graphql")
54
+ loader.setup
55
+
56
+ class SoulsApi < Sinatra::Base
57
+ include Pundit
58
+ include SoulsHelper
59
+ ::Logger.class_eval { alias_method :write, :<< }
60
+ access_log = ::File.join(::File.dirname(::File.expand_path(__FILE__)), "log", "access.log")
61
+ access_logger = ::Logger.new(access_log)
62
+ error_logger = ::File.new(::File.join(::File.dirname(::File.expand_path(__FILE__)), "log", "error.log"), "a+")
63
+ error_logger.sync = true
64
+
65
+ use Rack::JSONBodyParser
66
+ register Sinatra::ActiveRecordExtension
67
+
68
+ configure :production, :development do
69
+ set :logger, Logger.new($stdout)
70
+ enable :logging
71
+ use ::Rack::CommonLogger, access_logger
72
+ end
73
+
74
+ before { env["rack.errors"] = error_logger }
75
+
76
+ error StandardError do
77
+ StandardError.to_json
78
+ end
79
+
80
+ get "/" do
81
+ message = { success: true, message: "SOULs Running!", env: ENV["RACK_ENV"] }
82
+ json message
83
+ end
84
+
85
+ get "/db" do
86
+ message = { success: true, message: "SOULs Running!", env: ENV["RACK_ENV"], db: User.first.username }
87
+ json(message)
88
+ rescue StandardError => e
89
+ message = { error: e }
90
+ json(message)
91
+ end
92
+
93
+ post "/endpoint" do
94
+ token = request.env["HTTP_AUTHORIZATION"].split("Bearer ")[1] if request.env["HTTP_AUTHORIZATION"]
95
+
96
+ user = token ? login_auth(token: token) : nil
97
+ context = { user: user }
98
+ result = SoulsApiSchema.execute(params[:query], variables: params[:variables], context: context)
99
+ json(result)
100
+ rescue StandardError => e
101
+ message = { error: e }
102
+ json(message)
103
+ end
104
+
105
+ def login_auth(token:)
106
+ decoded_token = JsonWebToken.decode(token)
107
+ user_id = decoded_token[:user_id]
108
+ user = User.find(user_id)
109
+ raise(StandardError, "Invalid or Missing Token") if user.blank?
110
+
111
+ user
112
+ rescue StandardError => e
113
+ message = { error: e }
114
+ json(message)
115
+ end
116
+ end
File without changes
@@ -0,0 +1,30 @@
1
+ module Mutations
2
+ module Base::Article
3
+ class CreateArticle < BaseMutation
4
+ field :article_edge, Types::ArticleType.edge_type, null: false
5
+ field :error, String, null: true
6
+
7
+ argument :article_category_id, String, required: false
8
+ argument :body, String, required: false
9
+ argument :is_deleted, Boolean, required: false
10
+ argument :is_public, Boolean, required: false
11
+ argument :just_created, Boolean, required: false
12
+ argument :public_date, String, required: false
13
+ argument :slag, String, required: false
14
+ argument :tags, [String], required: false
15
+ argument :thumnail_url, String, required: false
16
+ argument :title, String, required: false
17
+
18
+ def resolve(**args)
19
+ args[:user_id] = context[:user].id
20
+ _, args[:article_category_id] = SoulsApiSchema.from_global_id(args[:article_category_id])
21
+ data = ::Article.new(args)
22
+ raise(StandardError, data.errors.full_messages) unless data.save
23
+
24
+ { article_edge: { node: data } }
25
+ rescue StandardError => e
26
+ GraphQL::ExecutionError.new(e)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ module Mutations
2
+ module Base::Article
3
+ class DeleteArticle < BaseMutation
4
+ field :article, Types::ArticleType, null: false
5
+ argument :id, String, required: true
6
+
7
+ def resolve(**args)
8
+ _, data_id = SoulsApiSchema.from_global_id(args[:id])
9
+ article = ::Article.find(data_id)
10
+ article.update(is_deleted: true)
11
+ { article: ::Article.find(data_id) }
12
+ rescue StandardError => e
13
+ GraphQL::ExecutionError.new(e)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Mutations
2
+ module Base::Article
3
+ class DestroyDeleteArticle < BaseMutation
4
+ field :article, Types::ArticleType, null: false
5
+ argument :id, String, required: true
6
+
7
+ def resolve(**args)
8
+ _, data_id = SoulsApiSchema.from_global_id(args[:id])
9
+ article = ::Article.find(data_id)
10
+ article.destroy
11
+ { article: article }
12
+ rescue StandardError => e
13
+ GraphQL::ExecutionError.new(e)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,30 @@
1
+ module Mutations
2
+ module Base::Article
3
+ class UpdateArticle < BaseMutation
4
+ field :article_edge, Types::ArticleType.edge_type, null: false
5
+
6
+ argument :article_category_id, String, required: false
7
+ argument :body, String, required: false
8
+ argument :id, String, required: true
9
+ argument :is_deleted, Boolean, required: false
10
+ argument :is_public, Boolean, required: false
11
+ argument :just_created, Boolean, required: false
12
+ argument :public_date, GraphQL::Types::ISO8601DateTime, required: false
13
+ argument :slag, String, required: false
14
+ argument :tags, [String], required: false
15
+ argument :thumnail_url, String, required: false
16
+ argument :title, String, required: false
17
+
18
+ def resolve(**args)
19
+ args[:user_id] = context[:user].id
20
+ _, args[:id] = SoulsApiSchema.from_global_id(args[:id])
21
+ _, args[:article_category_id] = SoulsApiSchema.from_global_id(args[:article_category_id])
22
+ article = ::Article.find(args[:id])
23
+ article.update(args)
24
+ { article_edge: { node: ::Article.find(args[:id]) } }
25
+ rescue StandardError => e
26
+ GraphQL::ExecutionError.new(e)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ module Mutations
2
+ module Base::ArticleCategory
3
+ class CreateArticleCategory < BaseMutation
4
+ field :article_category_edge, Types::ArticleCategoryType.edge_type, null: false
5
+ field :error, String, null: true
6
+
7
+ argument :is_deleted, Boolean, required: false
8
+ argument :name, String, required: false
9
+ argument :tags, [String], required: false
10
+
11
+ def resolve(**args)
12
+ data = ::ArticleCategory.new(args)
13
+ raise(StandardError, data.errors.full_messages) unless data.save
14
+
15
+ { article_category_edge: { node: data } }
16
+ rescue StandardError => e
17
+ GraphQL::ExecutionError.new(e)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ module Mutations
2
+ module Base::ArticleCategory
3
+ class DeleteArticleCategory < BaseMutation
4
+ field :article_category, Types::ArticleCategoryType, null: false
5
+ argument :id, String, required: true
6
+
7
+ def resolve(**args)
8
+ _, data_id = SoulsApiSchema.from_global_id(args[:id])
9
+ article_category = ::ArticleCategory.find(data_id)
10
+ article_category.update(is_deleted: true)
11
+ { article_category: ::ArticleCategory.find(data_id) }
12
+ rescue StandardError => e
13
+ GraphQL::ExecutionError.new(e)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Mutations
2
+ module Base::ArticleCategory
3
+ class DestroyDeleteArticleCategory < BaseMutation
4
+ field :article_category, Types::ArticleCategoryType, null: false
5
+ argument :id, String, required: true
6
+
7
+ def resolve(**args)
8
+ _, data_id = SoulsApiSchema.from_global_id(args[:id])
9
+ article_category = ::ArticleCategory.find(data_id)
10
+ article_category.destroy
11
+ { article_category: article_category }
12
+ rescue StandardError => e
13
+ GraphQL::ExecutionError.new(e)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ module Mutations
2
+ module Base::ArticleCategory
3
+ class UpdateArticleCategory < BaseMutation
4
+ field :article_category_edge, Types::ArticleCategoryType.edge_type, null: false
5
+
6
+ argument :id, String, required: true
7
+ argument :is_deleted, Boolean, required: false
8
+ argument :name, String, required: false
9
+ argument :tags, [String], required: false
10
+
11
+ def resolve(**args)
12
+ _, args[:id] = SoulsApiSchema.from_global_id(args[:id])
13
+ article_category = ::ArticleCategory.find(args[:id])
14
+ article_category.update(args)
15
+ { article_category_edge: { node: ::ArticleCategory.find(args[:id]) } }
16
+ rescue StandardError => e
17
+ GraphQL::ExecutionError.new(e)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ module Mutations
2
+ module Base::User
3
+ class CreateUser < BaseMutation
4
+ field :error, String, null: true
5
+ field :user_edge, Types::UserType.edge_type, null: false
6
+
7
+ argument :birthday, String, required: false
8
+ argument :email, String, required: false
9
+ argument :first_name, String, required: false
10
+ argument :first_name_kana, String, required: false
11
+ argument :first_name_kanji, String, required: false
12
+ argument :icon_url, String, required: false
13
+ argument :last_name, String, required: false
14
+ argument :last_name_kana, String, required: false
15
+ argument :last_name_kanji, String, required: false
16
+ argument :screen_name, String, required: false
17
+ argument :tel, String, required: false
18
+ argument :uid, String, required: false
19
+ argument :username, String, required: false
20
+
21
+ def resolve(**args)
22
+ data = ::User.new(args)
23
+ raise(StandardError, data.errors.full_messages) unless data.save
24
+
25
+ { user_edge: { node: data } }
26
+ rescue StandardError => e
27
+ GraphQL::ExecutionError.new(e)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ module Mutations
2
+ module Base::User
3
+ class DeleteUser < BaseMutation
4
+ field :user, Types::UserType, null: false
5
+ argument :id, String, required: true
6
+
7
+ def resolve(**args)
8
+ _, data_id = SoulsApiSchema.from_global_id(args[:id])
9
+ user = ::User.find(data_id)
10
+ user.update(is_deleted: true)
11
+ { user: ::User.find(data_id) }
12
+ rescue StandardError => e
13
+ GraphQL::ExecutionError.new(e)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Mutations
2
+ module Base::User
3
+ class DestroyDeleteUser < BaseMutation
4
+ field :user, Types::UserType, null: false
5
+ argument :id, String, required: true
6
+
7
+ def resolve(**args)
8
+ _, data_id = SoulsApiSchema.from_global_id(args[:id])
9
+ user = ::User.find(data_id)
10
+ user.destroy
11
+ { user: user }
12
+ rescue StandardError => e
13
+ GraphQL::ExecutionError.new(e)
14
+ end
15
+ end
16
+ end
17
+ end