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