Enable processing for different types

This commit is contained in:
Michał Zieliński
2023-11-08 18:09:01 +01:00
parent c1097a3e61
commit 51c167d02e

View File

@@ -177,9 +177,9 @@ namespace WebAPI.Controllers
} }
[HttpGet] [HttpGet]
[Route("AutoProcess/{apiKey}")] [Route("AutoProcess/{apiKey}/{type}")]
[AllowAnonymous] [AllowAnonymous]
public IActionResult AutoProcess(string apiKey) public IActionResult AutoProcess(string apiKey, string type)
{ {
if (Request.Host.Value != configuration["apiLocalUrl"] || apiKey != configuration["apiKey"]) if (Request.Host.Value != configuration["apiLocalUrl"] || apiKey != configuration["apiKey"])
{ {
@@ -192,7 +192,8 @@ namespace WebAPI.Controllers
.Include(x => x.Records) .Include(x => x.Records)
.Where(x => .Where(x =>
x.Records!.Any(x => x.Code == "Type" && x.Desc1 == "ProcessWorker") && x.Records!.Any(x => x.Code == "Type" && x.Desc1 == "ProcessWorker") &&
x.Records!.Any(x => x.Code == "IsEnabled" && x.Desc1 == "True") x.Records!.Any(x => x.Code == "IsEnabled" && x.Desc1 == "True") &&
x.Records!.Any(x => x.Code == "ProcessType" && x.Desc1 == type)
) )
.OrderBy(x => x.CreatedAt) .OrderBy(x => x.CreatedAt)
.ToList(); .ToList();