mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Contact list for REPP
This commit is contained in:
parent
29e35c6452
commit
d692088f3b
3 changed files with 28 additions and 0 deletions
|
@ -12,5 +12,6 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
mount Repp::DomainV1
|
mount Repp::DomainV1
|
||||||
|
mount Repp::ContactV1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
16
app/api/repp/contact_v1.rb
Normal file
16
app/api/repp/contact_v1.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Repp
|
||||||
|
class ContactV1 < Grape::API
|
||||||
|
version 'v1', using: :path
|
||||||
|
|
||||||
|
resource :contacts do
|
||||||
|
desc 'Return list of contact'
|
||||||
|
get '/' do
|
||||||
|
contacts = current_user.registrar.contacts.page(params[:page])
|
||||||
|
{
|
||||||
|
contacts: contacts,
|
||||||
|
total_pages: contacts.total_pages
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
config/initializers/reload_api.rb
Normal file
11
config/initializers/reload_api.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
if Rails.env.development?
|
||||||
|
ActiveSupport::Dependencies.explicitly_unloadable_constants << 'Repp::API'
|
||||||
|
|
||||||
|
api_files = Dir[Rails.root.join('app', 'api', '**', '*.rb')]
|
||||||
|
api_reloader = ActiveSupport::FileUpdateChecker.new(api_files) do
|
||||||
|
Rails.application.reload_routes!
|
||||||
|
end
|
||||||
|
ActionDispatch::Callbacks.to_prepare do
|
||||||
|
api_reloader.execute_if_updated
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue