Updating
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Serilog;
|
||||
using LCU.Api.Internal.ArchiverApi.Services;
|
||||
using LCU.Library.Internal.ArchiverApiModel.Models;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
namespace LCU.Api.Internal.ArchiverApi.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class QueueArchiverController : ControllerBase
|
||||
{
|
||||
private readonly IQueueArchiverService _queueArchiverService;
|
||||
|
||||
public QueueArchiverController(IQueueArchiverService queueArchiverService)
|
||||
{
|
||||
_queueArchiverService = queueArchiverService;
|
||||
}
|
||||
|
||||
[HttpPost("QueueArchiver")]
|
||||
public IActionResult QueueArchiver(ArchiveRequest archiveRequest)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState.Values);
|
||||
}
|
||||
|
||||
_queueArchiverService.QueueArchiver(archiveRequest);
|
||||
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