make temp scrape endpoint available only on debug

so I don't have to comment/uncomment all the time...
This commit is contained in:
Collin M. Barrett 2018-01-28 08:13:13 -06:00
parent 81b27866af
commit b11ea298e8
2 changed files with 6 additions and 2 deletions

View file

@ -16,9 +16,12 @@ public ScrapeController(ScrapeService scrapeService)
[HttpPost]
public async Task<IActionResult> Index()
{
//TODO: convert endpoint into scheduled job, don't expose on prod
//await scrapeService.Scrape();
#if DEBUG
await scrapeService.Scrape(5);
return Ok();
#else
return StatusCode(403);
#endif
}
}
}

View file

@ -17,6 +17,7 @@ public ScrapeService(FilterListsDbContext filterListsDbContext)
this.filterListsDbContext = filterListsDbContext;
}
//TODO: call via scheduled job
public async Task Scrape(int numberLists)
{
var lists = filterListsDbContext.FilterLists.OrderBy(x => x.ScrapedDateUtc).Take(numberLists)