data_privacy_tasks_controller.rb 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class DataPrivacyTasksController < ApplicationController
  3. prepend_before_action :authenticate_and_authorize!
  4. def index
  5. model_index_render(DataPrivacyTask, params)
  6. end
  7. def by_state
  8. scope = DataPrivacyTask.reorder('id DESC').limit(500)
  9. in_process = scope.where(state: 'in process')
  10. failed = scope.where(state: 'failed')
  11. completed = scope.where(state: 'completed')
  12. assets = ApplicationModel::CanAssets.reduce [in_process, failed, completed].flatten, {}
  13. render json: {
  14. record_ids: {
  15. in_process: in_process.pluck(:id),
  16. failed: failed.pluck(:id),
  17. completed: completed.pluck(:id)
  18. },
  19. assets: assets,
  20. }, status: :ok
  21. end
  22. def show
  23. model_show_render(DataPrivacyTask, params)
  24. end
  25. def create
  26. model_create_render(DataPrivacyTask, params)
  27. end
  28. def update
  29. model_update_render(DataPrivacyTask, params)
  30. end
  31. def destroy
  32. model_destroy_render(DataPrivacyTask, params)
  33. end
  34. end