public async Task <Response <MyVotesViewModel> > Handle(GetMyVotes request, CancellationToken cancellationToken)
        {
            var identity = _identityService.GetIdentity();
            var votes    = await _votesRepository.GetByVoter(identity.Id);

            var viewModel = _mapper.Map <IEnumerable <Vote>, MyVotesViewModel>(votes);

            return(viewModel);
        }
        public async Task <Response <QuestionResultViewModel> > Handle(GetQuestionResult request, CancellationToken cancellationToken)
        {
            var identity  = _identityService.GetIdentity();
            var userVotes = await _votesRepository.GetByVoter(identity.Id);

            var userVoted = userVotes.Any(v => v.QuestionId == request.QuestionId);

            if (!userVoted)
            {
                return(new AuthorizationError(
                           "results are only visible after voting"));
            }

            var question = await _questionsRepository.Get(request.QuestionId);

            if (question is null)
            {
                return(ObjectNotFoundError.CreateFor <Question>(request.QuestionId));
            }

            var viewModel = _mapper.Map <Question, QuestionResultViewModel>(question);

            return(viewModel);
        }