James Tombleson
117653c001
* Migration added to update Articles to define if Release or Commit * CodeProjectWatcher Job was created from GithubWatcher as this will target services like gitlab and also gitea. * article model was updated to reflect migration changes * Added CodeProjects to startup * Seed was updated with CodeProjects and some new defaults * Added Delete call for Sources * Added a route to cleanup all records based on SourceId * Added CodeProject const values to load from config * minor changes to the rss controller * Added codeprojects to the routes to trigger the job
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
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/rss")]
|
|
public class RssController
|
|
{
|
|
private readonly ConfigSectionConnectionStrings _connectionStrings;
|
|
private readonly ILogger<RssController> _logger;
|
|
private readonly ConfigSectionRssModel _rssConfig;
|
|
|
|
public RssController(ILogger<RssController> logger, IOptions<ConfigSectionConnectionStrings> connectionStrings,
|
|
IOptions<ConfigSectionRssModel> rss)
|
|
{
|
|
_logger = logger;
|
|
_connectionStrings = connectionStrings.Value;
|
|
_rssConfig = rss.Value;
|
|
}
|
|
|
|
[HttpPost("check")]
|
|
public void CheckReddit()
|
|
{
|
|
BackgroundJob.Enqueue<RssWatcherJob>(x => x.InitAndExecute(new RssWatcherJobOptions
|
|
{
|
|
ConnectionString = _connectionStrings.Database,
|
|
OpenTelemetry = _connectionStrings.OpenTelemetry,
|
|
IsEnabled = _rssConfig.IsEnabled
|
|
}));
|
|
}
|
|
} |