2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-08-31 16:18:06 +08:00
|
|
|
class UserAuthTokenSerializer < ApplicationSerializer
|
2018-09-03 10:44:22 +08:00
|
|
|
include UserAuthTokensMixin
|
2018-08-31 16:18:06 +08:00
|
|
|
|
2018-09-03 10:44:22 +08:00
|
|
|
attributes :seen_at
|
2018-10-09 22:21:41 +08:00
|
|
|
attributes :is_active
|
|
|
|
|
|
|
|
def include_is_active?
|
|
|
|
scope && scope.request
|
|
|
|
end
|
|
|
|
|
|
|
|
def is_active
|
2018-10-12 07:40:48 +08:00
|
|
|
scope.auth_token == object.auth_token
|
2018-10-09 22:21:41 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def seen_at
|
|
|
|
return object.created_at unless object.seen_at.present?
|
|
|
|
|
|
|
|
object.seen_at
|
|
|
|
end
|
2018-08-31 16:18:06 +08:00
|
|
|
end
|