Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/AgentesController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 3.29 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/AgentesController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/AgentesController.cs
-
curl -L -o AgentesController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/AgentesController.cs
3.29 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.Qualidade; | |
| using SCM.Application.Qualidade.Dtos; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Módulo MCQ — agentes de qualidade (inspetores/fiscais).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class AgentesController : ControllerBase | |
| { | |
| private readonly IAgenteService _service; | |
| public AgentesController(IAgenteService service) => _service = service; | |
| /// <summary>Lista todos os agentes (ordenados por nome).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<AgenteResponse>>> GetAll(CancellationToken ct = default) | |
| => Ok(await _service.GetAllAsync(ct)); | |
| /// <summary>Obtém um agente pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<AgenteResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria um agente de qualidade.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<AgenteResponse>> Create( | |
| [] CreateAgenteRequest 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 agente de qualidade.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<AgenteResponse>> Update( | |
| Guid id, [FromBody] UpdateAgenteRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui um agente (bloqueado se possuir programação associada).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| } | |