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
|
2024-05-27 06:27:13 -04:00
|
|
|
return object.created_at if object.seen_at.blank?
|
2018-10-09 10:21:41 -04:00
|
|
|
|
|
|
|
object.seen_at
|
|
|
|
end
|
2018-08-31 04:18:06 -04:00
|
|
|
end
|