mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 09:27:19 +02:00
25 lines
566 B
Ruby
25 lines
566 B
Ruby
# rubocop: disable Metrics/ClassLength
|
|
class ApiUser < ActiveRecord::Base
|
|
include Versions # version/api_user_version.rb
|
|
# TODO: should have max request limit per day
|
|
belongs_to :registrar
|
|
has_many :contacts
|
|
|
|
validates :username, :password, :registrar, presence: true
|
|
validates :username, uniqueness: true
|
|
|
|
attr_accessor :registrar_typeahead
|
|
|
|
def registrar_typeahead
|
|
@registrar_typeahead || registrar || nil
|
|
end
|
|
|
|
def to_s
|
|
username
|
|
end
|
|
|
|
def queued_messages
|
|
registrar.messages.queued
|
|
end
|
|
end
|
|
# rubocop: enable Metrics/ClassLength
|