Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/CriteriosEapController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 3.56 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/CriteriosEapController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/CriteriosEapController.cs
-
curl -L -o CriteriosEapController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/CriteriosEapController.cs
3.56 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.Medicao; | |
| using SCM.Application.Medicao.Dtos; | |
| using SCM.Domain.Medicao; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Módulo MMD — critérios EAP (critérios de medição).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class CriteriosEapController : ControllerBase | |
| { | |
| private readonly ICriterioEapService _service; | |
| public CriteriosEapController(ICriterioEapService service) => _service = service; | |
| /// <summary>Lista os critérios de um contrato (opcionalmente filtrando por tipo).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<CriterioEapResponse>>> GetByContrato( | |
| [] Guid contratoId, | |
| [] CriterioEapTipo? tipo = null, | |
| CancellationToken ct = default) | |
| => Ok(await _service.GetByContratoAsync(contratoId, tipo, ct)); | |
| /// <summary>Obtém um critério EAP pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<CriterioEapResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria um critério EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<CriterioEapResponse>> Create( | |
| [] CreateCriterioEapRequest 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 a descrição de um critério EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<CriterioEapResponse>> Update( | |
| Guid id, [FromBody] UpdateCriterioEapRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui um critério EAP (bloqueado se estiver em uso por linhas da EAP).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| } | |