1
0
mirror of https://github.com/mastodon/mastodon synced 2024-12-23 02:58:16 +09:00
mastodon/app/serializers/rest/admin/cohort_serializer.rb

20 lines
374 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class REST::Admin::CohortSerializer < ActiveModel::Serializer
attributes :period, :frequency
class CohortDataSerializer < ActiveModel::Serializer
attributes :date, :rate, :value
def date
object.date.iso8601
end
end
has_many :data, serializer: CohortDataSerializer
def period
object.period.iso8601
end
end