From b11ea298e8ef25fe5d826767db450afdb06b2a94 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sun, 28 Jan 2018 08:13:13 -0600 Subject: [PATCH] make temp scrape endpoint available only on debug so I don't have to comment/uncomment all the time... --- src/FilterLists.Api/V1/Controllers/ScrapeController.cs | 7 +++++-- src/FilterLists.Services/Services/ScrapeService.cs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/FilterLists.Api/V1/Controllers/ScrapeController.cs b/src/FilterLists.Api/V1/Controllers/ScrapeController.cs index e6b0451d0..5f39a35ec 100644 --- a/src/FilterLists.Api/V1/Controllers/ScrapeController.cs +++ b/src/FilterLists.Api/V1/Controllers/ScrapeController.cs @@ -16,9 +16,12 @@ public ScrapeController(ScrapeService scrapeService) [HttpPost] public async Task 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 } } } \ No newline at end of file diff --git a/src/FilterLists.Services/Services/ScrapeService.cs b/src/FilterLists.Services/Services/ScrapeService.cs index bb5cf054d..7d1c6f95d 100644 --- a/src/FilterLists.Services/Services/ScrapeService.cs +++ b/src/FilterLists.Services/Services/ScrapeService.cs @@ -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)