45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Serilog;
|
|
using LCU.Api.Internal.MaidBotApi.Services;
|
|
using LCU.Api.Internal.MaidBotLib.Models;
|
|
using LCU.Library.Internal.Exceptions;
|
|
namespace LCU.API.Internal.MaidBotApi.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
|
|
public class QueueEventLogController : ControllerBase
|
|
{
|
|
private readonly IQueueEventLogService _queueEventLogService;
|
|
|
|
public QueueEventLogController(IQueueEventLogService queueEventLogService)
|
|
{
|
|
_queueEventLogService = queueEventLogService;
|
|
}
|
|
|
|
[HttpPost]
|
|
[ProducesResponseType(202)]
|
|
[ProducesResponseType(typeof(List<string>), 400)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> Post([FromBody] EventLog EventLog)
|
|
{
|
|
try
|
|
{
|
|
await _queueEventLogService.QueueEventLog(EventLog);
|
|
return Accepted();
|
|
}
|
|
catch (ServiceException exception)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
Log.Error(exception, "Unexpected Exception");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
} |