Exemplo n.º 1
0
        public async Task <PinnedRepo> UploadRepoAsync(PinnedRepo pinnedRepo)
        {
            _logger.LogInformation(
                "Beginning upload of {repoName}, with info of {@repo}",
                pinnedRepo.Name,
                pinnedRepo
                );
            var repoWithUtc = ConvertTimesToUtc(pinnedRepo);

            // Get collection ref
            var pinnedReposRef = Db.Collection("pinned-repositories");

            // Make document ref in collection
            var pinnedRepoRef = pinnedReposRef.Document(repoWithUtc.DatabaseId);

            // write / update in Db
            var unused = await pinnedRepoRef.SetAsync(repoWithUtc);

            // get result of write
            var snapshot = await pinnedRepoRef.GetSnapshotAsync();

            // convert to model
            var updatedRepo = snapshot.ConvertTo <PinnedRepo>();

            return(updatedRepo);
        }
Exemplo n.º 2
0
        private static PinnedRepo ConvertTimesToUtc(PinnedRepo pinnedRepo)
        {
            var utcRepo = pinnedRepo;

            utcRepo.TimeFetched = pinnedRepo.TimeFetched.ToUniversalTime();
            utcRepo.CreatedAt   = pinnedRepo.CreatedAt.ToUniversalTime();
            utcRepo.UpdatedAt   = pinnedRepo.UpdatedAt.ToUniversalTime();
            return(utcRepo);
        }
Exemplo n.º 3
0
 private async Task UpdateItemStatus(JobStage stage, PinnedRepo pinnedRepo)
 {
     _itemStatus[pinnedRepo.DatabaseId] = stage;
     await _jobStatusNotifier.PushGithubRepoFetcherJobStatusUpdate(_itemStatus, _jobStatus);
 }