Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/ExecutoresController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 3.4 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/ExecutoresController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/ExecutoresController.cs
-
curl -L -o ExecutoresController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/ExecutoresController.cs
3.4 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.Controle; | |
| using SCM.Application.Controle.Dtos; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Executores de produção (MBC), por obra.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class ExecutoresController : ControllerBase | |
| { | |
| private readonly IExecutorService _service; | |
| public ExecutoresController(IExecutorService service) => _service = service; | |
| /// <summary>Lista os executores de uma obra (ordenados por código).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<ExecutorResponse>>> GetByObra( | |
| [] Guid obraId, CancellationToken ct = default) | |
| => Ok(await _service.GetByObraAsync(obraId, ct)); | |
| /// <summary>Obtém um executor pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<ExecutorResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria um executor.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<ExecutorResponse>> Create( | |
| [] CreateExecutorRequest 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 um executor (a obra é imutável).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<ExecutorResponse>> Update( | |
| Guid id, [FromBody] UpdateExecutorRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui um executor.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| } | |