calendars_controller.rb 980 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class CalendarsController < ApplicationController
  3. prepend_before_action { authentication_check && authorize! }
  4. def init
  5. assets = {}
  6. record_ids = []
  7. Calendar.all.order(:name, :created_at).each do |calendar|
  8. record_ids.push calendar.id
  9. assets = calendar.assets(assets)
  10. end
  11. ical_feeds = Calendar.ical_feeds
  12. timezones = Calendar.timezones
  13. render json: { record_ids:, ical_feeds:, timezones:, assets: }, status: :ok
  14. end
  15. def index
  16. model_index_render(Calendar, params)
  17. end
  18. def show
  19. model_show_render(Calendar, params)
  20. end
  21. def create
  22. model_create_render(Calendar, params)
  23. end
  24. def update
  25. model_update_render(Calendar, params)
  26. end
  27. def destroy
  28. model_references_check(Calendar, params)
  29. model_destroy_render(Calendar, params)
  30. end
  31. def timezones
  32. render json: {
  33. timezones: Calendar.timezones
  34. }
  35. end
  36. end