mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
Add offset support for repp domains
This commit is contained in:
parent
7b26ba58df
commit
df4cd1ee6d
2 changed files with 24 additions and 3 deletions
|
@ -6,15 +6,17 @@ module Repp
|
|||
desc 'Return list of domains'
|
||||
params do
|
||||
optional :limit, type: Integer, values: (1..20).to_a
|
||||
optional :offset, type: Integer
|
||||
end
|
||||
|
||||
get '/' do
|
||||
limit = params[:limit] || 20
|
||||
offset = params[:offset] || 0
|
||||
|
||||
if params[:details] == 'true'
|
||||
domains = current_user.registrar.domains.limit(limit)
|
||||
domains = current_user.registrar.domains.limit(limit).offset(offset)
|
||||
else
|
||||
domains = current_user.registrar.domains.limit(limit).pluck(:name)
|
||||
domains = current_user.registrar.domains.limit(limit).offset(offset).pluck(:name)
|
||||
end
|
||||
|
||||
@response = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue