normalise some json responses
This commit is contained in:
@ -49,7 +49,6 @@ module Admin
|
||||
authorize Candidate
|
||||
candidate = Candidate.find_by(id: params[:id])
|
||||
CandidateMailer.welcome(candidate).deliver_later
|
||||
render json: { message: "Email queued!" }.to_json
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -5,28 +5,12 @@ module Admin
|
||||
@candidate = Candidate.find_by(test_hash: params[:test_hash])
|
||||
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
|
||||
current_user.cast_yea_on(@candidate)
|
||||
|
||||
results = {
|
||||
message: "Vote Counted",
|
||||
upCount: @candidate.votes.yea.count,
|
||||
downCount: @candidate.votes.nay.count,
|
||||
myVote: "yea"
|
||||
}
|
||||
render json: results.to_json
|
||||
end
|
||||
|
||||
def down
|
||||
@candidate = Candidate.find_by(test_hash: params[:test_hash])
|
||||
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
|
||||
current_user.cast_nay_on(@candidate)
|
||||
|
||||
results = {
|
||||
message: "Vote Counted",
|
||||
upCount: @candidate.votes.yea.count,
|
||||
downCount: @candidate.votes.nay.count,
|
||||
myVote: "nay"
|
||||
}
|
||||
render json: results.to_json
|
||||
end
|
||||
|
||||
def approve
|
||||
@ -35,12 +19,6 @@ module Admin
|
||||
|
||||
if current_user.approve_candidate(@candidate)
|
||||
RecruiterMailer.interview_requested(@candidate).deliver_later
|
||||
results = {
|
||||
message: "Interview requested!",
|
||||
requestCopy: "Requested",
|
||||
declineCopy: "Decline Interview"
|
||||
}
|
||||
render json: results.to_json
|
||||
end
|
||||
end
|
||||
|
||||
@ -50,12 +28,6 @@ module Admin
|
||||
|
||||
if current_user.decline_candidate(@candidate)
|
||||
RecruiterMailer.interview_declined(@candidate).deliver_later
|
||||
results = {
|
||||
message: "Interview declined.",
|
||||
requestCopy: "Request Interview",
|
||||
declineCopy: "Declined"
|
||||
}
|
||||
render json: results.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user