public override async Task <FindChallengePayoutResponse> FindChallengePayout(FindChallengePayoutRequest request, ServerCallContext context) { var challenge = await _challengeQuery.FindChallengeAsync(request.ChallengeId.ParseEntityId <ChallengeId>()); if (challenge == null) { throw context.NotFoundRpcException("Challenge not found."); } var response = new FindChallengePayoutResponse { Payout = _mapper.Map <ChallengePayoutDto>(challenge) }; return(context.Ok(response)); }
public override async Task <FindChallengeResponse> FindChallenge(FindChallengeRequest request, ServerCallContext context) { var challengeId = request.ChallengeId.ParseEntityId <ChallengeId>(); if (!await _challengeService.ChallengeExistsAsync(challengeId)) { throw context.NotFoundRpcException("Challenge not found."); } var challenge = await _challengeQuery.FindChallengeAsync(challengeId); var response = new FindChallengeResponse { Challenge = ChallengeProfile.Map(challenge !) }; return(context.Ok(response)); }