add: implementacao inicial

This commit is contained in:
2025-08-25 00:06:43 -03:00
parent 2378741455
commit cf9f2a1179
9 changed files with 203 additions and 28 deletions

View File

@@ -0,0 +1,40 @@
using CampusWorkshops.Api.Dtos;
using CampusWorkshops.Api.Models;
using CampusWorkshops.Api.Repositories;
using Microsoft.AspNetCore.Mvc;
namespace CampusWorkshops.Api.Controllers;
[ApiController]
[Route("api/[controller]")]
public class WorkshopsController : ControllerBase
{
private readonly IWorkshopRepository _repo;
public WorkshopsController(IWorkshopRepository repo) => _repo = repo;
/// <summary>Lista workshops com filtros opcionais.</summary>
[HttpGet]
public Task<IActionResult> GetAll([FromQuery] DateTimeOffset? from, [FromQuery] DateTimeOffset? to, [FromQuery] string? q, CancellationToken ct)
{
// TODO: implementar usando _repo.GetAllAsync e mapear para WorkshopResponse
return Task.FromResult<IActionResult>(Ok(Array.Empty<WorkshopResponse>()));
}
/// <summary>Obtém um workshop por Id.</summary>
[HttpGet("{id:guid}")]
public Task<IActionResult> GetById(Guid id, CancellationToken ct)
{
// TODO: implementar usando _repo.GetByIdAsync
return Task.FromResult<IActionResult>(NotFound());
}
/// <summary>Cria um novo workshop.</summary>
[HttpPost]
public Task<IActionResult> Create([FromBody] CreateWorkshopRequest body, CancellationToken ct)
{
// TODO: validar ModelState, regras de negócio e chamar _repo.AddAsync; retornar CreatedAtAction
return Task.FromResult<IActionResult>(BadRequest());
}
}