13
14
15
16
17
18
19
20
21
22
23
24 
     | 
    
      # File 'app/graphql/mutations/recurring_logics/cancel.rb', line 13
def resolve(id:)
  recurring_logic = load_object_by(id: id)
  authorize!(recurring_logic, :edit)
  task_errors = []
  begin
    recurring_logic.cancel
  rescue => e
    task_errors = [{ path: ['tasks'], message: "There has been an error when canceling one of the tasks: #{e}" }]
  end
  errors = recurring_logic.errors.any? ? map_errors_to_path(recurring_logic) : []
  { recurring_logic: recurring_logic, errors: (errors + task_errors) }
end
     |