feat: bulk actions to update conversation objects (#3934)
Added the endpoints for bulk updating conversation objects Fixes: #3845 #3940 #3943
This commit is contained in:
parent
9059f5906a
commit
1ca1b4d36b
6 changed files with 295 additions and 1 deletions
26
app/controllers/api/v1/accounts/bulk_actions_controller.rb
Normal file
26
app/controllers/api/v1/accounts/bulk_actions_controller.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
class Api::V1::Accounts::BulkActionsController < Api::V1::Accounts::BaseController
|
||||
before_action :type_matches?
|
||||
|
||||
def create
|
||||
if type_matches?
|
||||
::BulkActionsJob.perform_later(
|
||||
account: @current_account,
|
||||
user: current_user,
|
||||
params: permitted_params
|
||||
)
|
||||
head :ok
|
||||
else
|
||||
render json: { success: false }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def type_matches?
|
||||
['Conversation'].include?(params[:type])
|
||||
end
|
||||
|
||||
def permitted_params
|
||||
params.permit(:type, ids: [], fields: [:status, :assignee_id, :team_id], labels: [add: [], remove: []])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue