using Hangfire; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Newsbot.Collector.Domain.Models.Config; using Newsbot.Collector.Services.Jobs; namespace Newsbot.Collector.Api.Controllers; [ApiController] [Route("api/codeprojects")] public class CodeProjectController { private readonly ConfigSectionConnectionStrings _connectionStrings; private readonly ILogger _logger; public CodeProjectController(ILogger logger, IOptions settings) { _logger = logger; _connectionStrings = settings.Value; } [HttpPost("check")] public void PullNow() { BackgroundJob.Enqueue(x => x.InitAndExecute(new CodeProjectWatcherJobOptions { ConnectionStrings = _connectionStrings, FeaturePullReleases = true, FeaturePullCommits = true })); } }