Adding
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
using LCU.Api.Internal.Dispatcher.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCU.Api.Internal.Dispatcher.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class WorkItemController : ControllerBase
|
||||
{
|
||||
private readonly IWorkItemService _workItemService;
|
||||
|
||||
public WorkItemController(IWorkItemService workItemService)
|
||||
{
|
||||
_workItemService = workItemService;
|
||||
}
|
||||
|
||||
[HttpPost("GetWorkItemsByJobId")]
|
||||
[ProducesResponseType(typeof(IEnumerable<WorkItem>), 200)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> GetWorkItemsByJobId(int jobId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _workItemService.GetByJobIdWithExecutionsAsync(jobId);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (ServiceException)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error(exception, "Unexpected Exception");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user