chats_controller.rb 735 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class ChatsController < ApplicationController
  3. prepend_before_action { authentication_check && authorize! }
  4. def index
  5. chat_ids = []
  6. assets = {}
  7. Chat.order(:id).each do |chat|
  8. chat_ids.push chat.id
  9. assets = chat.assets(assets)
  10. end
  11. setting = Setting.find_by(name: 'chat')
  12. assets = setting.assets(assets)
  13. render json: {
  14. chat_ids: chat_ids,
  15. assets: assets,
  16. }
  17. end
  18. def show
  19. model_show_render(Chat, params)
  20. end
  21. def create
  22. model_create_render(Chat, params)
  23. end
  24. def update
  25. model_update_render(Chat, params)
  26. end
  27. def destroy
  28. model_destroy_render(Chat, params)
  29. end
  30. end