add private endpoint for match reporting
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Player-facing match details. Only participants of a match can view it:
|
||||
# a non-participant (or an unknown uuid) gets 404 to avoid leaking
|
||||
# information about other players' matches.
|
||||
class Api::MatchesController < ApplicationController
|
||||
def show
|
||||
match = Match.for_user(current_user).find_by(uuid: params[:uuid])
|
||||
return render json: { error: "Match not found" }, status: :not_found unless match
|
||||
|
||||
render json: { match: MatchSerializer.as_json(match, viewer: current_user) }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user