Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/AtividadesCiclicasController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 4.15 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/AtividadesCiclicasController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/AtividadesCiclicasController.cs
-
curl -L -o AtividadesCiclicasController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/AtividadesCiclicasController.cs
4.15 kB
| using Asp.Versioning; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SCM.Application.AtividadesCiclicas; | |
| using SCM.Shared.Api; | |
| using SCM.Shared.Constants; | |
| namespace SCM.Api.Controllers; | |
| /// <summary>Configuração de atividades cíclicas + geração manual de ocorrências.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class AtividadesCiclicasController : ControllerBase | |
| { | |
| private readonly IAtividadeCiclicaService _service; | |
| private readonly IOcorrenciaAtividadeService _ocorrenciaService; | |
| public AtividadesCiclicasController(IAtividadeCiclicaService service, IOcorrenciaAtividadeService ocorrenciaService) | |
| { | |
| _service = service; | |
| _ocorrenciaService = ocorrenciaService; | |
| } | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<AtividadeCiclicaResponse>>> GetAll([FromQuery] Guid? obraId = null, CancellationToken ct = default) | |
| => Ok(await _service.GetAllAsync(obraId, ct)); | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<AtividadeCiclicaResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<AtividadeCiclicaResponse>> Create([FromBody] CreateAtividadeCiclicaRequest request, CancellationToken ct = default) | |
| { | |
| var criado = await _service.CreateAsync(request, ct); | |
| return CreatedAtAction(nameof(GetById), new { id = criado.Id, version = "1.0" }, criado); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<AtividadeCiclicaResponse>> Update(Guid id, [FromBody] UpdateAtividadeCiclicaRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Desativar(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DesativarAsync(id, ct); | |
| return NoContent(); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| /// <summary>Gera manualmente as ocorrências devidas (até hoje) de todas as atividades ativas.</summary> | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<GerarOcorrenciasResponse>> GerarOcorrencias(CancellationToken ct = default) | |
| => Ok(await _ocorrenciaService.GerarPendentesAsync(null, ct)); | |
| } | |