Files
Dalan/app/api/v2/entities/user_with_full_info.rb
2026-08-13 19:56:46 +03:30

81 lines
2.1 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# frozen_string_literal: true
module API
module V2
module Entities
# User information containing profile, labels and documents
class UserWithFullInfo < API::V2::Entities::Base
expose :email,
documentation: {
type: 'String',
desc: 'User Email'
}
expose :uid,
documentation: {
type: 'String',
desc: 'User UID'
}
expose :role,
documentation: {
type: 'String',
desc: 'User role'
}
expose :level,
documentation: {
type: 'Integer',
desc: 'User level'
}
expose :otp,
documentation: {
type: 'Boolean',
desc: 'is 2FA enabled for account'
}
expose :state,
documentation: {
type: 'String',
desc: 'User state: active, pending, inactive'
}
expose :referral_uid,
documentation: {
type: 'String',
desc: 'UID of referrer'
} do |user|
user.referral_uid
end
expose :data,
documentation: {
type: 'String',
desc: 'Additional phone and profile info'
}
expose :csrf_token,
documentation: {
type: 'String',
desc: 'Сsrf protection token'
},
if: ->(_, options) { options[:csrf_token] } do |_user, options|
options[:csrf_token]
end
expose :labels, using: Entities::Label
expose :phones, using: Entities::Phone
expose :profiles, using: Entities::Profile
expose :data_storages, using: Entities::DataStorage
# activities, as sensitive and potentialy too big data should be queried separately
with_options(format_with: :iso_timestamp) do
expose :created_at
expose :updated_at
end
end
end
end
end