41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
|
|
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());
|
|
}
|
|
}
|