2019-05-13 10:37:49 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-12-29 12:31:05 +00:00
|
|
|
require_relative "./rule_serializer"
|
2017-07-18 16:17:03 +01:00
|
|
|
|
2021-07-13 14:36:16 -05:00
|
|
|
class DiscourseChatIntegration::ChannelSerializer < ApplicationSerializer
|
2018-08-20 12:05:59 +01:00
|
|
|
attributes :id, :provider, :error_key, :error_info, :data, :rules
|
2017-07-18 16:17:03 +01:00
|
|
|
|
|
|
|
def rules
|
2017-07-18 21:36:07 +01:00
|
|
|
object.rules.order_by_precedence.map do |rule|
|
2021-07-13 14:36:16 -05:00
|
|
|
DiscourseChatIntegration::RuleSerializer.new(rule, root: false)
|
2017-07-18 16:17:03 +01:00
|
|
|
end
|
|
|
|
end
|
2017-08-01 20:53:39 +01:00
|
|
|
end
|