Ejemplo n.º 1
0
        public async Task <PinnedReposResult> GetPinnedRepos(bool onlyCurrent)
        {
            try
            {
                var repos = await _repoRepository.GetPinnedReposAsync(onlyCurrent);

                var mostRecentFirst = repos.OrderByDescending(repo => repo.UpdatedAt);
                var result          = new PinnedReposResult
                {
                    Data    = new List <PinnedRepo>(mostRecentFirst),
                    Details = new ResultDetails {
                        ResultStatus = ResultStatus.Success
                    }
                };
                return(result);
            }
            catch (Exception exception)
            {
                _logger.LogError(exception, "Retrieving pinned repositories from Firebase failed.");
                var result = new PinnedReposResult
                {
                    Details = new ResultDetails {
                        ResultStatus = ResultStatus.Failure
                    }
                };
                return(result);
            }
        }
Ejemplo n.º 2
0
        private async Task <IEnumerable <PinnedRepo> > MakeAllPinnedReposNonCurrent()
        {
            _logger.LogInformation("Making all pinned repositories un-pinned.");
            var currentPinnedRepos = await _repoRepository.GetPinnedReposAsync(true);

            foreach (var currentPinnedRepo in currentPinnedRepos)
            {
                currentPinnedRepo.Current = false;
            }
            var nonCurrentRepos = await UploadReposAsync(currentPinnedRepos);

            _logger.LogInformation("Completed making all pinned repositories un-pinned.");
            return(nonCurrentRepos);
        }