2017-07-18 11:17:03 -04:00
|
|
|
require_relative './rule_serializer'
|
|
|
|
|
|
|
|
class DiscourseChat::ChannelSerializer < ApplicationSerializer
|
2017-07-18 18:08:06 -04:00
|
|
|
attributes :id, :provider, :error_key, :data, :rules
|
2017-07-18 11:17:03 -04:00
|
|
|
|
|
|
|
def rules
|
2017-07-18 16:36:07 -04:00
|
|
|
object.rules.order_by_precedence.map do |rule|
|
2017-07-18 11:17:03 -04:00
|
|
|
DiscourseChat::RuleSerializer.new(rule, root:false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|