28 lines
903 B
C#
28 lines
903 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SytelineSaAppEfDataModel.Dtos;
|
|
using SytelineSaAppEfDataModel.Services;
|
|
|
|
namespace FaKrosnoApi.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
[Authorize]
|
|
public class ErrorLogController(IErrorLogService service) : Controller
|
|
{
|
|
[HttpGet]
|
|
public async Task<ActionResult<IEnumerable<ErrorLogDto>>> GetAll()
|
|
{
|
|
IEnumerable<ErrorLogDto?> errorLogs = await service.GetAll();
|
|
return Ok(errorLogs);
|
|
}
|
|
|
|
[HttpGet("by-order-number")]
|
|
public async Task<ActionResult<IEnumerable<ErrorLogDto>>> GetByCustomerOrderNumber([FromQuery] Guid customerOrderNumber)
|
|
{
|
|
var errorLogs = await service.GetByOrderNumber(customerOrderNumber);
|
|
return errorLogs.Any() ? Ok(errorLogs) : NotFound();
|
|
}
|
|
}
|
|
}
|