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