Spaces:
Runtime error
Runtime error
Download src/SCM.Api/Controllers/GruposTrabalhoController.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 4.5 kB
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/GruposTrabalhoController.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Api/Controllers/GruposTrabalhoController.cs
-
curl -L -o GruposTrabalhoController.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Api/Controllers/GruposTrabalhoController.cs
4.5 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>Grupos de trabalho (responsáveis por atividades cíclicas) e seus membros.</summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class GruposTrabalhoController : ControllerBase | |
| { | |
| private readonly IGrupoTrabalhoService _service; | |
| public GruposTrabalhoController(IGrupoTrabalhoService service) => _service = service; | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<GrupoTrabalhoResponse>>> GetAll(CancellationToken ct = default) | |
| => Ok(await _service.GetAllAsync(ct)); | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<GrupoTrabalhoResponse>> GetById(Guid id, CancellationToken ct = default) | |
| => Ok(await _service.GetByIdAsync(id, ct)); | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<GrupoTrabalhoResponse>> Create([FromBody] CreateGrupoTrabalhoRequest 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<GrupoTrabalhoResponse>> Update(Guid id, [FromBody] UpdateGrupoTrabalhoRequest request, CancellationToken ct = default) | |
| => Ok(await _service.UpdateAsync(id, request, ct)); | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> Delete(Guid id, CancellationToken ct = default) | |
| { | |
| await _service.DeleteAsync(id, ct); | |
| return NoContent(); | |
| } | |
| // --- membros --- | |
| [] | |
| [] | |
| public async Task<ActionResult<IReadOnlyList<MembroGrupoResponse>>> Membros(Guid grupoId, CancellationToken ct = default) | |
| => Ok(await _service.ListarMembrosAsync(grupoId, ct)); | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<ActionResult<MembroGrupoResponse>> AdicionarMembro(Guid grupoId, [FromBody] AddMembroRequest request, CancellationToken ct = default) | |
| { | |
| var membro = await _service.AdicionarMembroAsync(grupoId, request, ct); | |
| return CreatedAtAction(nameof(Membros), new { grupoId, version = "1.0" }, membro); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public async Task<IActionResult> RemoverMembro(Guid grupoId, Guid userId, CancellationToken ct = default) | |
| { | |
| await _service.RemoverMembroAsync(grupoId, userId, ct); | |
| return NoContent(); | |
| } | |
| } | |