Files
monorepo/LCU.API.Internal.DocumentIngestor/LCU.API.Internal.DocumentIngestor/Controllers/PdfPartitionerController.cs
T
2026-03-25 14:50:13 -05:00

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);
}
}
}