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