mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Refactor EPP users to API users
This commit is contained in:
parent
b8494993ea
commit
c91c9c8ebf
44 changed files with 154 additions and 150 deletions
24
app/models/api_user.rb
Normal file
24
app/models/api_user.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# rubocop: disable Metrics/ClassLength
|
||||
class ApiUser < ActiveRecord::Base
|
||||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue