From e4cee81702d75a2dc968fd4d4a8e5bbf57251dc9 Mon Sep 17 00:00:00 2001 From: FinnIckler Date: Tue, 12 Nov 2024 11:41:28 +0100 Subject: [PATCH] Add internal waiting_list route for migration (#734) * add internal waiting_list route for migration * don't break if the competition has no waiting list --- app/controllers/internal_controller.rb | 10 ++++++++++ config/routes.rb | 1 + 2 files changed, 11 insertions(+) diff --git a/app/controllers/internal_controller.rb b/app/controllers/internal_controller.rb index 1eb0488c..34b634df 100644 --- a/app/controllers/internal_controller.rb +++ b/app/controllers/internal_controller.rb @@ -121,4 +121,14 @@ def history history = RegistrationHistory.find(attendee_id) render json: history end + + def waiting_list + competition_id = params.require(:competition_id) + begin + waiting_list = WaitingList.find(competition_id) + render json: waiting_list.entries + rescue Dynamoid::Errors::RecordNotFound + render json: [] + end + end end diff --git a/config/routes.rb b/config/routes.rb index 8cf590d6..41561bd8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,6 +11,7 @@ get '/healthcheck', to: 'healthcheck#index' post '/api/internal/v1/update_payment', to: 'internal#update_payment_status' get '/api/internal/v1/:competition_id/registrations', to: 'internal#list_registrations' + get '/api/internal/v1/:competition_id/waiting_list', to: 'internal#waiting_list' post '/api/internal/v1/:competition_id/add', to: 'internal#create' get '/api/internal/v1/:attendee_id', to: 'internal#show_registration' get '/api/internal/v1/:attendee_id/history', to: 'internal#history'