Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
Add internal route to get registrations by attendee id (#620)
Browse files Browse the repository at this point in the history
* add internal route to get registrations by attendee id

* run rubocop
  • Loading branch information
FinnIckler authored Jul 17, 2024
1 parent fea979c commit a4593ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/internal_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'time'

class InternalController < ApplicationController
prepend_before_action :validate_wca_token unless Rails.env.development?
prepend_before_action :validate_wca_token unless Rails.env.local?
skip_before_action :validate_jwt_token

def validate_wca_token
Expand Down Expand Up @@ -76,4 +76,10 @@ def registrations_for_user
registrations = Registration.where(user_id: user_id).to_a
render json: registrations
end

def show_registration
attendee_id = params.require(:attendee_id)
registration = Registration.find_by(id: attendee_id)
render json: registration
end
end
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/:attendee_id', to: 'internal#show_registration'
get '/api/internal/v1/users/:user_id/registrations', to: 'internal#registrations_for_user'
get '/api/v1/register', to: 'registration#show'
post '/api/v1/register', to: 'registration#create'
Expand Down

0 comments on commit a4593ca

Please sign in to comment.