Ejemplo n.º 1
0
        public async Task <ActionResult <IEnumerable <GeminiIssue> > > GetGeminiAcceptedIssues(long projectId,
                                                                                               [FromQuery] IssuesQueryParameters issueQueryParameters)
        {
            var accepted = await _geminiRepository.GetAcceptedIssuesAsync(projectId, issueQueryParameters, CancellationToken.None).ConfigureAwait(false);

            var issues = accepted.ToList();

            if (!issues.Any())
            {
                return(Ok(_mapper.Map <IEnumerable <GeminiIssue> >(issues)));
            }

            var ids     = issues.Select(s => s.IssueId).ToList();
            var history = await _geminiRepository.GetIssuesHistoriesAsync(ids, CancellationToken.None).ConfigureAwait(false);

            var geminiIssues = _mapper.Map <IEnumerable <GeminiIssue> >(issues);

            foreach (var issue in geminiIssues)
            {
                if (history.ContainsKey(issue.IssueId))
                {
                    var acceptedItem = history.Single(x => x.Key == issue.IssueId).Value
                                       .FirstOrDefault(
                        c => c.History.IndexOf("angenommen", StringComparison.InvariantCultureIgnoreCase) >= 0);

                    issue.IssueUri     = _geminiUrlHelper.BuilIssuedUri(issue);
                    issue.AcceptedDate = acceptedItem?.Created;
                }
            }

            Response.Headers.Add("X-Pagination",
                                 JsonSerializer.Serialize("Not Supported"));

            return(Ok(geminiIssues));
        }
        public async Task <ActionResult <IEnumerable <GeminiIssueHistory> > > GetGeminiHistories(long issueId)
        {
            var issuesHistoryItems = await _geminiRepository.GetIssuesHistoriesAsync(new List <decimal> {
                issueId
            }, CancellationToken.None).ConfigureAwait(false);

            if (!issuesHistoryItems.Any())
            {
                return(NotFound());
            }

            var items = issuesHistoryItems.Single().Value;

            return(Ok(_mapper.Map <IEnumerable <GeminiIssueHistory> >(items)));
        }