2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-09 23:19:32 +08:00
|
|
|
class InvitedUserSerializer < ApplicationSerializer
|
|
|
|
attributes :id, :redeemed_at, :user, :invite_source
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2020-06-09 23:19:32 +08:00
|
|
|
def id
|
|
|
|
object.invite.id
|
2013-10-04 16:06:32 +08:00
|
|
|
end
|
|
|
|
|
2020-06-09 23:19:32 +08:00
|
|
|
def user
|
|
|
|
ser = InvitedUserRecordSerializer.new(object.user, scope: scope, root: false)
|
|
|
|
ser.invited_by = object.invite.invited_by
|
|
|
|
ser.as_json
|
2014-03-22 02:13:04 +08:00
|
|
|
end
|
|
|
|
|
2020-06-09 23:19:32 +08:00
|
|
|
def invite_source
|
|
|
|
object.invite.is_invite_link? ? "link" : "email"
|
2013-10-04 16:06:32 +08:00
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|