diff options
Diffstat (limited to 'app/graphql/mutations/design_management/update.rb')
-rw-r--r-- | app/graphql/mutations/design_management/update.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/graphql/mutations/design_management/update.rb b/app/graphql/mutations/design_management/update.rb new file mode 100644 index 00000000000..67732b70f29 --- /dev/null +++ b/app/graphql/mutations/design_management/update.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Mutations + module DesignManagement + class Update < ::Mutations::BaseMutation + graphql_name "DesignManagementUpdate" + + authorize :update_design + + argument :id, ::Types::GlobalIDType[::DesignManagement::Design], + required: true, + description: "ID of the design to update." + + argument :description, GraphQL::Types::String, + required: false, + description: copy_field_description(Types::DesignManagement::DesignType, :description) + + field :design, Types::DesignManagement::DesignType, + null: false, + description: "Updated design." + + def resolve(id:, description:) + design = authorized_find!(id: id) + design.update(description: description) + + { + design: design.reset, + errors: errors_on_object(design) + } + end + end + end +end |