Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/EapsController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 7.95 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/EapsController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/EapsController.cs
-
curl -L -o EapsController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/EapsController.cs
7.95 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.Medicao; | |
| using SCM.Application.Medicao.Dtos; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Linhas da EAP (MMD), por obra, com associação a critério de medição.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class EapsController : ControllerBase | |
| { | |
| private readonly IEapService _service; | |
| public EapsController(IEapService service) => _service = service; | |
| /// <summary>Lista as EAPs de uma obra (ordenadas por código).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<EapResponse>>> GetByObra( | |
| [] Guid obraId, CancellationToken ct = default) | |
| => Ok(await _service.GetByObraAsync(obraId, ct)); | |
| /// <summary>Obtém uma EAP pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<EapResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria uma linha da EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<EapResponse>> Create( | |
| [] CreateEapRequest 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 linha da EAP (a obra é imutável).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<EapResponse>> Update( | |
| Guid id, [FromBody] UpdateEapRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui uma linha da EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| /// <summary>Associa um critério de medição à EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<EapResponse>> AssociarCriterio( | |
| Guid id, [FromBody] AssociarCriterioRequest request, CancellationToken ct = default) | |
| => Ok(await _service.AssociarCriterioAsync(id, request, ct)); | |
| /// <summary>Obtém o planejamento (qt FEED/projeto/HH) por item do critério da EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<PlanejamentoItemResponse>>> GetPlanejamento( | |
| Guid id, [FromServices] IEapPlanejamentoService planejamentoService, CancellationToken ct = default) | |
| => Ok(await planejamentoService.GetByEapAsync(id, ct)); | |
| /// <summary>Define (reconstrói) o planejamento por item do critério associado à EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<PlanejamentoItemResponse>>> DefinirPlanejamento( | |
| Guid id, [FromBody] DefinirPlanejamentoRequest request, | |
| [] IEapPlanejamentoService planejamentoService, CancellationToken ct = default) | |
| => Ok(await planejamentoService.DefinirAsync(id, request, ct)); | |
| /// <summary>Obtém a linha de base (curva S) da EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<LinhaBasePontoResponse>>> GetLinhaBase( | |
| Guid id, [FromServices] ILinhaBaseService linhaBaseService, CancellationToken ct = default) | |
| => Ok(await linhaBaseService.GetByEapAsync(id, ct)); | |
| /// <summary>Define (reconstrói) a linha de base — curva acumulada não-decrescente.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<LinhaBasePontoResponse>>> DefinirLinhaBase( | |
| Guid id, [FromBody] DefinirLinhaBaseRequest request, | |
| [] ILinhaBaseService linhaBaseService, CancellationToken ct = default) | |
| => Ok(await linhaBaseService.DefinirAsync(id, request, ct)); | |
| /// <summary>Remove o ponto da semana informada da linha de base.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> RemoverPontoLinhaBase( | |
| Guid id, int semana, [FromServices] ILinhaBaseService linhaBaseService, CancellationToken ct = default) | |
| { | |
| await linhaBaseService.RemoverPontoAsync(id, semana, ct); | |
| return NoContent(); | |
| } | |
| /// <summary>Desassocia o critério de medição da EAP.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<EapResponse>> DesassociarCriterio(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.DesassociarCriterioAsync(id, ct)); | |
| } | |