This commit is contained in:
2020-01-27 22:50:10 +00:00
parent 76e7d98319
commit dafdaac654
3 changed files with 9 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
@@ -51,7 +52,7 @@ namespace AyaNova.Api.Controllers
/// <param name="timeZoneOffset">Value in hours of local time zone offset from UTC / GMT. This ensures that data is generated relative to the desired time zone</param>
/// <returns></returns>
[HttpPost("seed/{size}/{timeZoneOffset}")]
public ActionResult SeedTrialDatabase([FromRoute] string size,[FromRoute] decimal timeZoneOffset )
public async Task<IActionResult> SeedTrialDatabase([FromRoute] string size,[FromRoute] decimal timeZoneOffset )
{
if (!serverState.IsOpen)
{
@@ -101,10 +102,10 @@ namespace AyaNova.Api.Controllers
j.JobType = JobType.SeedTestData;
j.Exclusive = true;//don't run other jobs, this will erase the db
j.JobInfo = o.ToString();
JobsBiz.AddJobAsync(j, ct);
await JobsBiz.AddJobAsync(j, ct);
//Log
EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.TrialSeeder, AyaEvent.Created, size), ct);
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.TrialSeeder, AyaEvent.Created, size), ct);
return Accepted(new { JobId = j.GId });//202 accepted
}