travis-api/lib/travis/api/v3/models/user.rb

23 lines
660 B
Ruby

module Travis::API::V3
class Models::User < Model
has_many :memberships, dependent: :destroy
has_many :permissions, dependent: :destroy
has_many :emails, dependent: :destroy
has_many :tokens, dependent: :destroy
has_many :organizations, through: :memberships
has_many :repositories, as: :owner
has_many :starred_repositories #TODO
has_one :subscription, as: :owner
serialize :github_oauth_token, Extensions::EncryptedColumn.new(disable: true)
def token
tokens.first_or_create.token
end
def subscription
super if Features.use_subscriptions?
end
end
end