Adding
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LCU.Api.Internal.Dispatcher.Services;
|
||||
namespace LCU.Api.Internal.Dispatcher.Controllers;
|
||||
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class ExecutionMessageController : ControllerBase
|
||||
{
|
||||
private readonly IExecutionMessageService _executionMessageService;
|
||||
public ExecutionMessageController(IExecutionMessageService executionMessageService)
|
||||
{
|
||||
_executionMessageService = executionMessageService;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[ProducesResponseType(typeof(List<ExecutionMessage>), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> Post([FromBody] List<ExecutionMessage> request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (request == null || !request.Any())
|
||||
{
|
||||
return BadRequest("Execution messages are required.");
|
||||
}
|
||||
|
||||
await _executionMessageService.SaveExecutionMessages(request);
|
||||
return Ok();
|
||||
}
|
||||
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