Example #1
0
        public async Task <IActionResult> Get(string id)
        {
            var repo = await _repo.Get(id);

            if (repo == null)
            {
                return(NotFound());
            }

            var returnModel = _mapper.Map <RepositoryConfigModel>(repo);

            return(Ok(returnModel));
        }
Example #2
0
        public async Task <IActionResult> UpdateDependencies([FromBody] DependencyUpdate model)
        {
            var repo = await _repo.Get(model.RepositoryId);

            if (repo == null)
            {
                return(NotFound());
            }

            string reviewer = string.Empty;

            if (Request.Cookies.ContainsKey("squid-bb-user"))
            {
                string squidBbUserName = Request.Cookies["squid-bb-user"];
                if (!string.IsNullOrWhiteSpace(squidBbUserName))
                {
                    reviewer = Encoding.UTF8.GetString(Convert.FromBase64String(squidBbUserName));
                }
            }

            BackgroundJob.Enqueue(
                () => new DependencyUpdateJob(
                    _logger,
                    _client)
                .Execute(repo, model.Updates, reviewer));

            return(Accepted());
        }