Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/DeliveryOrdersController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 3.7 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/DeliveryOrdersController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/DeliveryOrdersController.cs
-
curl -L -o DeliveryOrdersController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/DeliveryOrdersController.cs
3.7 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.Materiais; | |
| using SCM.Application.Materiais.Dtos; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Delivery Orders (MSP) — recebimento físico de itens de material, por obra.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class DeliveryOrdersController : ControllerBase | |
| { | |
| private readonly IDeliveryOrderService _service; | |
| public DeliveryOrdersController(IDeliveryOrderService service) => _service = service; | |
| /// <summary>Lista as DOs de uma obra (filtros opcionais: notaFiscal LIKE, tipo macro).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<DeliveryOrderResponse>>> GetByObra( | |
| [] Guid obraId, [FromQuery] string? notaFiscal = null, | |
| [] Guid? tipoMaterialMacroId = null, CancellationToken ct = default) | |
| => Ok(await _service.GetByObraAsync(obraId, notaFiscal, tipoMaterialMacroId, ct)); | |
| /// <summary>Obtém uma DO pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<DeliveryOrderResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria uma DO (par nota fiscal + item único por obra; tipo macro precisa de agrupador).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<DeliveryOrderResponse>> Create( | |
| [] CreateDeliveryOrderRequest request, CancellationToken ct = default) | |
| { | |
| var created = await _service.CreateAsync(request, ct); | |
| return CreatedAtAction(nameof(GetById), new { id = created.Id, version = "1.0" }, created); | |
| } | |
| /// <summary>Altera uma DO (a obra é imutável).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<DeliveryOrderResponse>> Update( | |
| Guid id, [FromBody] UpdateDeliveryOrderRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui uma DO.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| } | |