2018-09-07 21:19:20 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Api
|
|
|
|
module V1
|
|
|
|
class ActivitySerializer < ActiveModel::Serializer
|
|
|
|
type :activities
|
2018-10-07 17:49:11 +08:00
|
|
|
attributes :id, :type_of, :message
|
|
|
|
belongs_to :project, serializer: ProjectSerializer
|
2018-10-26 23:30:04 +08:00
|
|
|
belongs_to :experiment, serializer: ExperimentSerializer,
|
2018-10-07 17:49:11 +08:00
|
|
|
if: -> { object.experiment.present? }
|
|
|
|
belongs_to :my_module, key: :task,
|
|
|
|
serializer: TaskSerializer,
|
|
|
|
class_name: 'MyModule',
|
|
|
|
if: -> { object.my_module.present? }
|
|
|
|
belongs_to :user, serializer: UserSerializer
|
2018-09-07 21:19:20 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|