Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/SubAtividadesPadraoController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 3.58 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/SubAtividadesPadraoController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/SubAtividadesPadraoController.cs
-
curl -L -o SubAtividadesPadraoController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/SubAtividadesPadraoController.cs
3.58 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>Catálogo de sub-atividades padrão (base de campos de inspeção, máscaras e produção).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class SubAtividadesPadraoController : ControllerBase | |
| { | |
| private readonly ISubAtividadePadraoService _service; | |
| public SubAtividadesPadraoController(ISubAtividadePadraoService service) => _service = service; | |
| /// <summary>Lista as sub-atividades padrão de uma obra (ordenadas por código).</summary> | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<SubAtividadePadraoResponse>>> GetByObra( | |
| [] Guid obraId, CancellationToken ct = default) | |
| => Ok(await _service.GetByObraAsync(obraId, ct)); | |
| /// <summary>Obtém uma sub-atividade padrão pelo identificador.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<SubAtividadePadraoResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| /// <summary>Cria uma sub-atividade padrão.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<SubAtividadePadraoResponse>> Create( | |
| [] CreateSubAtividadePadraoRequest 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 sub-atividade padrão (a obra é imutável).</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<SubAtividadePadraoResponse>> Update( | |
| Guid id, [FromBody] UpdateSubAtividadePadraoRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| /// <summary>Exclui uma sub-atividade padrão.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| } | |