You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
739 B
25 lines
739 B
class Competitions::PrizeLeaderAccountsController < Competitions::BaseController
|
|
before_action :require_prize_team_leader!
|
|
|
|
def update
|
|
Competitions::SavePrizeTeamAccountService.call(current_competition, current_user, update_params)
|
|
render_ok
|
|
rescue ApplicationService::Error => ex
|
|
render_error(ex.message)
|
|
end
|
|
|
|
private
|
|
|
|
def require_prize_team_leader!
|
|
prize_user = current_competition.competition_prize_users.joins(:competition_prize)
|
|
.where(competition_prizes: { category: :bonus })
|
|
.find_by(leader: true, user_id: current_user.id)
|
|
return if prize_user.present?
|
|
|
|
render_forbidden
|
|
end
|
|
|
|
def update_params
|
|
params.permit(:bank, :second_bank, :card_no)
|
|
end
|
|
end |