summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/boards/lists/base_update.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/boards/lists/base_update.rb')
-rw-r--r--app/graphql/mutations/boards/lists/base_update.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/graphql/mutations/boards/lists/base_update.rb b/app/graphql/mutations/boards/lists/base_update.rb
new file mode 100644
index 00000000000..b06cb3b1e32
--- /dev/null
+++ b/app/graphql/mutations/boards/lists/base_update.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+module Mutations
+ module Boards
+ module Lists
+ class BaseUpdate < BaseMutation
+ argument :position, GraphQL::INT_TYPE,
+ required: false,
+ description: 'Position of list within the board.'
+
+ argument :collapsed, GraphQL::BOOLEAN_TYPE,
+ required: false,
+ description: 'Indicates if the list is collapsed for this user.'
+
+ def resolve(list: nil, **args)
+ if list.nil? || !can_read_list?(list)
+ raise_resource_not_available_error!
+ end
+
+ update_result = update_list(list, args)
+
+ {
+ list: update_result.payload[:list],
+ errors: update_result.errors
+ }
+ end
+
+ private
+
+ def update_list(list, args)
+ raise NotImplementedError
+ end
+
+ def can_read_list?(list)
+ raise NotImplementedError
+ end
+ end
+ end
+ end
+end