feat(OrderController): create and add GetDocument endpoint
This commit is contained in:
31
src/Leanetec.EConnect.Proxy/Controllers/OrderController.cs
Normal file
31
src/Leanetec.EConnect.Proxy/Controllers/OrderController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Leanetec.EConnect.Client.Order;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Leanetec.EConnect.Proxy.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class OrderController : ControllerBase
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public OrderController(IMediator mediator)
|
||||
{
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
[HttpGet("document")]
|
||||
public async Task<IActionResult> GetDocument([FromQuery] GetDocumentRequest request, CancellationToken cancel)
|
||||
{
|
||||
var res = await _mediator.Send(request, cancel);
|
||||
if(res.Ok)
|
||||
{
|
||||
return res.Data is null ? NotFound() : Ok(res.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return StatusCode(res?.Error?.Status ?? 500, res?.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
<Folder Include="Controllers\NewFolder\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user