calendars_controller.rb 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (C) 2012-2022 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: {
  14. record_ids: record_ids,
  15. ical_feeds: ical_feeds,
  16. timezones: timezones,
  17. assets: assets,
  18. }, status: :ok
  19. end
  20. def index
  21. model_index_render(Calendar, params)
  22. end
  23. def show
  24. model_show_render(Calendar, params)
  25. end
  26. def create
  27. model_create_render(Calendar, params)
  28. end
  29. def update
  30. model_update_render(Calendar, params)
  31. end
  32. def destroy
  33. model_references_check(Calendar, params)
  34. model_destroy_render(Calendar, params)
  35. end
  36. def timezones
  37. render json: {
  38. timezones: Calendar.timezones
  39. }
  40. end
  41. end