souls 0.24.1 → 0.24.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 +4 -4
- data/exe/souls +12 -1
- data/lib/souls.rb +181 -123
- data/lib/souls/gcloud/iam.rb +30 -16
- data/lib/souls/init.rb +22 -16
- data/lib/souls/version.rb +1 -1
- metadata +16 -193
- data/.gitignore +0 -15
- data/.irbrc +0 -2
- data/.rspec +0 -3
- data/.rubocop.yml +0 -152
- data/.ruby-version +0 -1
- data/.travis.yml +0 -6
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -98
- data/Rakefile +0 -23
- data/Steepfile +0 -8
- data/api_v0.0.1.tar.gz +0 -0
- data/apps/api/.env.sample +0 -7
- data/apps/api/.gitignore +0 -32
- data/apps/api/.irbrc +0 -1
- data/apps/api/.rspec +0 -3
- data/apps/api/.rubocop.yml +0 -132
- data/apps/api/.ruby-version +0 -1
- data/apps/api/CODE_OF_CONDUCT.md +0 -74
- data/apps/api/Dockerfile +0 -16
- data/apps/api/Dockerfile.dev +0 -17
- data/apps/api/Gemfile +0 -50
- data/apps/api/Gemfile.lock +0 -412
- data/apps/api/LICENSE.txt +0 -67
- data/apps/api/Procfile +0 -2
- data/apps/api/Procfile.dev +0 -2
- data/apps/api/README.md +0 -37
- data/apps/api/Rakefile +0 -5
- data/apps/api/app.rb +0 -114
- data/apps/api/app/engines/notification_engine.rb +0 -5
- data/apps/api/app/graphql/mutations/.keep +0 -0
- data/apps/api/app/graphql/mutations/base/article/create_article.rb +0 -30
- data/apps/api/app/graphql/mutations/base/article/delete_article.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article/destroy_delete_article.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article/update_article.rb +0 -30
- data/apps/api/app/graphql/mutations/base/article_category/create_article_category.rb +0 -21
- data/apps/api/app/graphql/mutations/base/article_category/delete_article_category.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article_category/destroy_delete_article_category.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article_category/update_article_category.rb +0 -21
- data/apps/api/app/graphql/mutations/base/user/create_user.rb +0 -31
- data/apps/api/app/graphql/mutations/base/user/delete_user.rb +0 -17
- data/apps/api/app/graphql/mutations/base/user/destroy_delete_user.rb +0 -17
- data/apps/api/app/graphql/mutations/base/user/update_user.rb +0 -31
- data/apps/api/app/graphql/mutations/base_mutation.rb +0 -65
- data/apps/api/app/graphql/mutations/managers/user_manager/add_user_role.rb +0 -22
- data/apps/api/app/graphql/mutations/managers/user_manager/remove_user_role.rb +0 -22
- data/apps/api/app/graphql/mutations/managers/user_manager/sign_in_user.rb +0 -45
- data/apps/api/app/graphql/queries/article.rb +0 -13
- data/apps/api/app/graphql/queries/article_categories.rb +0 -11
- data/apps/api/app/graphql/queries/article_category.rb +0 -13
- data/apps/api/app/graphql/queries/articles.rb +0 -11
- data/apps/api/app/graphql/queries/base_query.rb +0 -12
- data/apps/api/app/graphql/queries/me.rb +0 -11
- data/apps/api/app/graphql/queries/user.rb +0 -13
- data/apps/api/app/graphql/queries/users.rb +0 -11
- data/apps/api/app/graphql/resolvers/article_category_search.rb +0 -41
- data/apps/api/app/graphql/resolvers/article_search.rb +0 -57
- data/apps/api/app/graphql/resolvers/base.rb +0 -17
- data/apps/api/app/graphql/resolvers/user_search.rb +0 -63
- data/apps/api/app/graphql/souls_api_schema.rb +0 -43
- data/apps/api/app/graphql/types/.keep +0 -0
- data/apps/api/app/graphql/types/article_category_type.rb +0 -12
- data/apps/api/app/graphql/types/article_type.rb +0 -30
- data/apps/api/app/graphql/types/base/base_argument.rb +0 -4
- data/apps/api/app/graphql/types/base/base_enum.rb +0 -4
- data/apps/api/app/graphql/types/base/base_field.rb +0 -5
- data/apps/api/app/graphql/types/base/base_input_object.rb +0 -5
- data/apps/api/app/graphql/types/base/base_interface.rb +0 -7
- data/apps/api/app/graphql/types/base/base_object.rb +0 -6
- data/apps/api/app/graphql/types/base/base_scalar.rb +0 -4
- data/apps/api/app/graphql/types/base/base_union.rb +0 -4
- data/apps/api/app/graphql/types/base/mutation_type.rb +0 -26
- data/apps/api/app/graphql/types/base/query_type.rb +0 -18
- data/apps/api/app/graphql/types/connections/article_category_connection.rb +0 -3
- data/apps/api/app/graphql/types/connections/article_connection.rb +0 -3
- data/apps/api/app/graphql/types/connections/base_connection.rb +0 -14
- data/apps/api/app/graphql/types/connections/user_connection.rb +0 -3
- data/apps/api/app/graphql/types/edges/article_category_edge.rb +0 -5
- data/apps/api/app/graphql/types/edges/article_edge.rb +0 -5
- data/apps/api/app/graphql/types/edges/base_edge.rb +0 -4
- data/apps/api/app/graphql/types/edges/user_edge.rb +0 -5
- data/apps/api/app/graphql/types/user_type.rb +0 -24
- data/apps/api/app/models/article.rb +0 -4
- data/apps/api/app/models/article_category.rb +0 -3
- data/apps/api/app/models/user.rb +0 -19
- data/apps/api/app/policies/application_policy.rb +0 -40
- data/apps/api/app/policies/article_category_policy.rb +0 -31
- data/apps/api/app/policies/article_policy.rb +0 -31
- data/apps/api/app/policies/user_policy.rb +0 -35
- data/apps/api/app/utils/association_loader.rb +0 -50
- data/apps/api/app/utils/fire_store.rb +0 -9
- data/apps/api/app/utils/firebase_id_token.rb +0 -4
- data/apps/api/app/utils/json_web_token.rb +0 -13
- data/apps/api/app/utils/record_loader.rb +0 -10
- data/apps/api/app/utils/souls_helper.rb +0 -18
- data/apps/api/cloudbuild.yml +0 -32
- data/apps/api/config.ru +0 -17
- data/apps/api/config/database.yml +0 -33
- data/apps/api/config/souls.rb +0 -10
- data/apps/api/constants/areas.rb +0 -71
- data/apps/api/constants/column_name_ja.rb +0 -27
- data/apps/api/db/migrate/20200006095538_create_users.rb +0 -30
- data/apps/api/db/migrate/20200712180236_create_article_categories.rb +0 -12
- data/apps/api/db/migrate/20200714215521_create_articles.rb +0 -22
- data/apps/api/db/schema.rb +0 -78
- data/apps/api/db/seeds.rb +0 -44
- data/apps/api/github/workflows/delivery.yml +0 -81
- data/apps/api/log/.keep +0 -0
- data/apps/api/spec/factories/article_categories.rb +0 -9
- data/apps/api/spec/factories/articles.rb +0 -17
- data/apps/api/spec/factories/users.rb +0 -23
- data/apps/api/spec/models/article_category_spec.rb +0 -7
- data/apps/api/spec/models/article_spec.rb +0 -7
- data/apps/api/spec/models/user_spec.rb +0 -7
- data/apps/api/spec/mutations/base/article_category_spec.rb +0 -46
- data/apps/api/spec/mutations/base/article_spec.rb +0 -70
- data/apps/api/spec/mutations/base/user_spec.rb +0 -76
- data/apps/api/spec/policies/article_category_policy_spec.rb +0 -25
- data/apps/api/spec/policies/article_policy_spec.rb +0 -25
- data/apps/api/spec/policies/user_policy_spec.rb +0 -5
- data/apps/api/spec/queries/article_category_spec.rb +0 -39
- data/apps/api/spec/queries/article_spec.rb +0 -53
- data/apps/api/spec/queries/user_spec.rb +0 -59
- data/apps/api/spec/resolvers/article_category_search_spec.rb +0 -54
- data/apps/api/spec/resolvers/article_search_spec.rb +0 -68
- data/apps/api/spec/resolvers/user_search_spec.rb +0 -74
- data/apps/api/spec/spec_helper.rb +0 -110
- data/apps/api/tmp/.keep +0 -0
- data/apps/worker/.env.sample +0 -9
- data/apps/worker/.gitignore +0 -32
- data/apps/worker/.irbrc +0 -1
- data/apps/worker/.rspec +0 -3
- data/apps/worker/.rubocop.yml +0 -132
- data/apps/worker/.ruby-version +0 -1
- data/apps/worker/CODE_OF_CONDUCT.md +0 -74
- data/apps/worker/Dockerfile +0 -16
- data/apps/worker/Dockerfile.dev +0 -17
- data/apps/worker/Gemfile +0 -49
- data/apps/worker/Gemfile.lock +0 -396
- data/apps/worker/LICENSE.txt +0 -67
- data/apps/worker/Procfile +0 -1
- data/apps/worker/Procfile.dev +0 -1
- data/apps/worker/README.md +0 -37
- data/apps/worker/Rakefile +0 -5
- data/apps/worker/app.rb +0 -101
- data/apps/worker/app/engines/notification_engine.rb +0 -5
- data/apps/worker/app/graphql/mutations/.keep +0 -0
- data/apps/worker/app/graphql/mutations/base_mutation.rb +0 -16
- data/apps/worker/app/graphql/mutations/workers/send_user_mail_job.rb +0 -31
- data/apps/worker/app/graphql/souls_api_schema.rb +0 -43
- data/apps/worker/app/graphql/types/.keep +0 -0
- data/apps/worker/app/graphql/types/base/base_argument.rb +0 -4
- data/apps/worker/app/graphql/types/base/base_enum.rb +0 -4
- data/apps/worker/app/graphql/types/base/base_field.rb +0 -5
- data/apps/worker/app/graphql/types/base/base_input_object.rb +0 -5
- data/apps/worker/app/graphql/types/base/base_interface.rb +0 -7
- data/apps/worker/app/graphql/types/base/base_object.rb +0 -5
- data/apps/worker/app/graphql/types/base/base_scalar.rb +0 -4
- data/apps/worker/app/graphql/types/base/base_union.rb +0 -4
- data/apps/worker/app/graphql/types/base/mutation_type.rb +0 -12
- data/apps/worker/app/graphql/types/base/query_type.rb +0 -6
- data/apps/worker/app/models/article.rb +0 -4
- data/apps/worker/app/models/article_category.rb +0 -3
- data/apps/worker/app/models/user.rb +0 -19
- data/apps/worker/app/utils/fire_store.rb +0 -9
- data/apps/worker/app/utils/souls_helper.rb +0 -96
- data/apps/worker/cloudbuild.yml +0 -32
- data/apps/worker/config.ru +0 -17
- data/apps/worker/config/database.yml +0 -33
- data/apps/worker/config/souls.rb +0 -10
- data/apps/worker/db/migrate/20200006095538_create_users.rb +0 -30
- data/apps/worker/db/migrate/20200712180236_create_article_categories.rb +0 -12
- data/apps/worker/db/migrate/20200714215521_create_articles.rb +0 -22
- data/apps/worker/db/schema.rb +0 -78
- data/apps/worker/db/seeds.rb +0 -44
- data/apps/worker/github/workflows/delivery.yml +0 -81
- data/apps/worker/log/.keep +0 -0
- data/apps/worker/spec/factories/article_categories.rb +0 -9
- data/apps/worker/spec/factories/articles.rb +0 -17
- data/apps/worker/spec/factories/users.rb +0 -23
- data/apps/worker/spec/models/article_category_spec.rb +0 -7
- data/apps/worker/spec/models/article_spec.rb +0 -7
- data/apps/worker/spec/models/user_spec.rb +0 -7
- data/apps/worker/spec/spec_helper.rb +0 -110
- data/apps/worker/tmp/.keep +0 -0
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/config/souls.rb +0 -9
- data/db/schema.rb +0 -67
- data/rbs/init.rbs +0 -2
- data/souls.gemspec +0 -34
- data/souls_api2.tar.gz +0 -0
data/apps/api/Procfile
DELETED
data/apps/api/Procfile.dev
DELETED
data/apps/api/README.md
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# SOULs Serverless GraphQL API Boilerplate
|
2
|
-
SOULs Serverless GraphQL API 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
|
-
|
13
|
-
## SOULs Document
|
14
|
-
|
15
|
-
- [SOULs Document](https://souls.elsoul.nl/)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
## Development
|
22
|
-
|
23
|
-
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.
|
24
|
-
|
25
|
-
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).
|
26
|
-
|
27
|
-
## Contributing
|
28
|
-
|
29
|
-
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.
|
30
|
-
|
31
|
-
## License
|
32
|
-
|
33
|
-
The gem is available as open source under the terms of the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
|
34
|
-
|
35
|
-
## Code of Conduct
|
36
|
-
|
37
|
-
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/blob/master/CODE_OF_CONDUCT.md).
|
data/apps/api/Rakefile
DELETED
data/apps/api/app.rb
DELETED
@@ -1,114 +0,0 @@
|
|
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 "sinatra/activerecord"
|
10
|
-
require "rack/contrib"
|
11
|
-
require "zeitwerk"
|
12
|
-
require "factory_bot"
|
13
|
-
require "faker"
|
14
|
-
require "dotenv/load"
|
15
|
-
require "firebase_id_token"
|
16
|
-
require "graphql"
|
17
|
-
require "google/cloud/firestore"
|
18
|
-
require "google/cloud/storage"
|
19
|
-
require "google/cloud/pubsub"
|
20
|
-
require "logger"
|
21
|
-
require "base64"
|
22
|
-
require "slack/ruby3"
|
23
|
-
require "role_model"
|
24
|
-
require "pundit"
|
25
|
-
require "sendgrid-ruby"
|
26
|
-
require "search_object"
|
27
|
-
require "search_object/plugin/graphql"
|
28
|
-
require "graphql/batch"
|
29
|
-
|
30
|
-
ENV["RACK_ENV"] ||= "development"
|
31
|
-
Dir["./config/*.rb"].each { |f| require f unless f.include?("souls.rb") }
|
32
|
-
Dir["./constants/*.rb"].each { |f| require f }
|
33
|
-
|
34
|
-
db_conf = YAML.safe_load(ERB.new(File.read("./config/database.yml")).result, permitted_classes: [Date], aliases: true)
|
35
|
-
ActiveRecord::Base.establish_connection(db_conf[ENV["RACK_ENV"]])
|
36
|
-
ActiveRecord::Base.default_timezone = :local
|
37
|
-
|
38
|
-
loader = Zeitwerk::Loader.new
|
39
|
-
loader.push_dir("#{Dir.pwd}/app/models")
|
40
|
-
loader.push_dir("#{Dir.pwd}/app/utils")
|
41
|
-
loader.push_dir("#{Dir.pwd}/app/engines")
|
42
|
-
loader.push_dir("#{Dir.pwd}/app/policies")
|
43
|
-
|
44
|
-
loader.collapse("#{__dir__}/app/types")
|
45
|
-
loader.collapse("#{__dir__}/app/mutations")
|
46
|
-
loader.collapse("#{__dir__}/app/queries")
|
47
|
-
loader.collapse("#{__dir__}/app/resolvers")
|
48
|
-
loader.collapse("#{__dir__}/app/graphql/types/connections")
|
49
|
-
loader.collapse("#{__dir__}/app/graphql/types/edges")
|
50
|
-
loader.collapse("#{__dir__}/app/graphql/types/base")
|
51
|
-
loader.push_dir("#{Dir.pwd}/app/graphql")
|
52
|
-
loader.setup
|
53
|
-
|
54
|
-
class SoulsApi < Sinatra::Base
|
55
|
-
include Pundit
|
56
|
-
include SoulsHelper
|
57
|
-
::Logger.class_eval { alias_method :write, :<< }
|
58
|
-
access_log = ::File.join(::File.dirname(::File.expand_path(__FILE__)), "log", "access.log")
|
59
|
-
access_logger = ::Logger.new(access_log)
|
60
|
-
error_logger = ::File.new(::File.join(::File.dirname(::File.expand_path(__FILE__)), "log", "error.log"), "a+")
|
61
|
-
error_logger.sync = true
|
62
|
-
|
63
|
-
use Rack::JSONBodyParser
|
64
|
-
register Sinatra::ActiveRecordExtension
|
65
|
-
|
66
|
-
configure :production, :development do
|
67
|
-
set :logger, Logger.new($stdout)
|
68
|
-
enable :logging
|
69
|
-
use ::Rack::CommonLogger, access_logger
|
70
|
-
end
|
71
|
-
|
72
|
-
before { env["rack.errors"] = error_logger }
|
73
|
-
|
74
|
-
error StandardError do
|
75
|
-
StandardError.to_json
|
76
|
-
end
|
77
|
-
|
78
|
-
get "/" do
|
79
|
-
message = { success: true, message: "SOULs Running!", env: ENV["RACK_ENV"] }
|
80
|
-
json message
|
81
|
-
end
|
82
|
-
|
83
|
-
get "/db" do
|
84
|
-
message = { success: true, message: "SOULs Running!", env: ENV["RACK_ENV"], db: User.first.username }
|
85
|
-
json(message)
|
86
|
-
rescue StandardError => e
|
87
|
-
message = { error: e }
|
88
|
-
json(message)
|
89
|
-
end
|
90
|
-
|
91
|
-
post "/endpoint" do
|
92
|
-
token = request.env["HTTP_AUTHORIZATION"].split("Bearer ")[1] if request.env["HTTP_AUTHORIZATION"]
|
93
|
-
|
94
|
-
user = token ? login_auth(token: token) : nil
|
95
|
-
context = { user: user }
|
96
|
-
result = SoulsApiSchema.execute(params[:query], variables: params[:variables], context: context)
|
97
|
-
json(result)
|
98
|
-
rescue StandardError => e
|
99
|
-
message = { error: e }
|
100
|
-
json(message)
|
101
|
-
end
|
102
|
-
|
103
|
-
def login_auth(token:)
|
104
|
-
decoded_token = JsonWebToken.decode(token)
|
105
|
-
user_id = decoded_token[:user_id]
|
106
|
-
user = User.find(user_id)
|
107
|
-
raise(StandardError, "Invalid or Missing Token") if user.blank?
|
108
|
-
|
109
|
-
user
|
110
|
-
rescue StandardError => e
|
111
|
-
message = { error: e }
|
112
|
-
json(message)
|
113
|
-
end
|
114
|
-
end
|
File without changes
|
@@ -1,30 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
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
|
@@ -1,30 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
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
|
data/apps/api/app/graphql/mutations/base/article_category/destroy_delete_article_category.rb
DELETED
@@ -1,17 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,31 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
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
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Mutations
|
2
|
-
module Base::User
|
3
|
-
class UpdateUser < BaseMutation
|
4
|
-
field :user_edge, Types::UserType.edge_type, null: false
|
5
|
-
|
6
|
-
argument :birthday, String, required: false
|
7
|
-
argument :email, String, required: false
|
8
|
-
argument :first_name, String, required: false
|
9
|
-
argument :first_name_kana, String, required: false
|
10
|
-
argument :first_name_kanji, String, required: false
|
11
|
-
argument :icon_url, String, required: false
|
12
|
-
argument :id, String, required: true
|
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
|
-
_, args[:id] = SoulsApiSchema.from_global_id(args[:id])
|
23
|
-
user = ::User.find(args[:id])
|
24
|
-
user.update(args)
|
25
|
-
{ user_edge: { node: ::User.find(args[:id]) } }
|
26
|
-
rescue StandardError => e
|
27
|
-
GraphQL::ExecutionError.new(e)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|