Sha256: 1642528d31f41631e26bf1b2f357cb949c293b7173028555c8388eeecc0fe52b

Contents?: true

Size: 661 Bytes

Versions: 4

Compression:

Stored size: 661 Bytes

Contents

module Mutations
  module Base::ArticleCategory
    class CreateArticleCategory < BaseMutation
      field :article_category_edge, Types::ArticleCategoryType.edge_type, null: false
      field :error, String, null: true

      argument :is_deleted, Boolean, required: false
      argument :name, String, required: false
      argument :tags, [String], required: false

      def resolve(**args)
        data = ::ArticleCategory.new(args)
        raise(StandardError, data.errors.full_messages) unless data.save

        { article_category_edge: { node: data } }
      rescue StandardError => e
        GraphQL::ExecutionError.new(e)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
souls-0.24.2 apps/api/app/graphql/mutations/base/article_category/create_article_category.rb
souls-0.24.1 apps/api/app/graphql/mutations/base/article_category/create_article_category.rb
souls-0.22.8 hoy/app/graphql/mutations/base/article_category/create_article_category.rb
souls-0.22.7 hoy/app/graphql/mutations/base/article_category/create_article_category.rb