mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
parent
93055acb3a
commit
9b4aa478bf
4 changed files with 90 additions and 9 deletions
|
@ -2,4 +2,13 @@ class EppSession < ActiveRecord::Base
|
|||
belongs_to :user, required: true
|
||||
|
||||
validates :session_id, uniqueness: true, presence: true
|
||||
|
||||
def self.limit_per_registrar
|
||||
4
|
||||
end
|
||||
|
||||
def self.limit_reached?(registrar)
|
||||
count = where(user_id: registrar.api_users.ids).where('updated_at >= ?', Time.zone.now - 1.second).count
|
||||
count >= limit_per_registrar
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue