40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Serilog;
|
|
using LCU.Library.Internal.Exceptions;
|
|
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
|
using LCU.API.Internal.DocumentIngestor.Services.QueueServices;
|
|
namespace LCU.API.Internal.DocumentIngestor.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class PdfPartitionerController : ControllerBase
|
|
{
|
|
private readonly IQueuePdfPartitionerService _queuePdfPartitionerService;
|
|
|
|
public PdfPartitionerController(IQueuePdfPartitionerService queuePdfPartitionerService)
|
|
{
|
|
_queuePdfPartitionerService = queuePdfPartitionerService;
|
|
}
|
|
|
|
[HttpPost("QueueIngestorPdfPartitioner")]
|
|
[ProducesResponseType(202)]
|
|
[ProducesResponseType(400)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> QueueIngestorPdfPartitioner([FromBody] PdfPartitionerRequest request)
|
|
{
|
|
try
|
|
{
|
|
await _queuePdfPartitionerService.QueuePdfPartitionerRequest(request);
|
|
return Accepted();
|
|
}
|
|
catch (ServiceException exception)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
Log.Error(exception, "Unexpected Exception");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
} |