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

44 lines
1.5 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;
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
namespace LCU.API.Internal.DocumentIngestor.Controllers;
[Obsolete("06/02/2023 - Used to prepare historical documents for ingestion. No longer in use.")]
[ApiController]
[Route("[controller]")]
public class OsgPreprocessorController : ControllerBase
{
private readonly IOsgPreprocessorService _osgPreprocessorService;
public OsgPreprocessorController(IOsgPreprocessorService osgPreprocessorService)
{
_osgPreprocessorService = osgPreprocessorService;
}
[HttpPost("PreprocessOsgIndexFile")]
[ProducesResponseType(202)]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
public async Task<IActionResult> PreprocessOsgIndexFile([FromBody] OsgPreprocessorRequest request)
{
try
{
await _osgPreprocessorService.HandleOsgPreprocessing(request);
return Accepted();
}
catch (ServiceException exception)
{
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
}
catch (Exception exception)
{
Log.Error(exception, "Unexpected Exception");
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
}