diff options
Diffstat (limited to 'app/graphql/mutations/saved_replies/create.rb')
-rw-r--r-- | app/graphql/mutations/saved_replies/create.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/graphql/mutations/saved_replies/create.rb b/app/graphql/mutations/saved_replies/create.rb new file mode 100644 index 00000000000..d97461a1c2a --- /dev/null +++ b/app/graphql/mutations/saved_replies/create.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Mutations + module SavedReplies + class Create < Base + graphql_name 'SavedReplyCreate' + + authorize :create_saved_replies + + argument :name, GraphQL::Types::String, + required: true, + description: copy_field_description(Types::SavedReplyType, :name) + + argument :content, GraphQL::Types::String, + required: true, + description: copy_field_description(Types::SavedReplyType, :content) + + def resolve(name:, content:) + raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled? + + result = ::Users::SavedReplies::CreateService.new(current_user: current_user, name: name, content: content).execute + present_result(result) + end + end + end +end |