From 6acc1aa8b398844b4e2989c80f11071ec18d08de Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Sun, 24 Nov 2024 16:51:43 +0000 Subject: [PATCH] Add sponsors_logins action to OwnersController and update routes --- app/controllers/api/v1/owners_controller.rb | 6 ++++++ config/routes.rb | 1 + 2 files changed, 7 insertions(+) diff --git a/app/controllers/api/v1/owners_controller.rb b/app/controllers/api/v1/owners_controller.rb index 68dccbbd..bb2c1642 100644 --- a/app/controllers/api/v1/owners_controller.rb +++ b/app/controllers/api/v1/owners_controller.rb @@ -71,4 +71,10 @@ def lookup @pagy, @owners = pagy_countless(scope) fresh_when @owners, public: true end + + def sponsors_logins + @host = Host.find_by_name!(params[:host_id]) + @sponsors_logins = @host.owners.has_sponsors_listing.pluck(:login) + render json: @sponsors_logins + end end diff --git a/config/routes.rb b/config/routes.rb index 1563bed3..94ff222c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,6 +30,7 @@ resources :owners, only:[:index, :show] do collection do get :lookup + get :sponsors_logins end member do get :repositories