using Asp.Versioning; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using TarninaHub.Application.Abstractions; using TarninaHub.Application.Dtos; namespace TarninaHub.Controllers; [ApiController] [ApiVersion("1.0")] [Route("api/grant-calls")] [Authorize] public class GrantCallsController : ControllerBase { private readonly IGrantCallService _grantCalls; public GrantCallsController(IGrantCallService grantCalls) { _grantCalls = grantCalls; } [HttpGet] public async Task>> List( [FromQuery] string? status, CancellationToken cancellationToken) { var calls = await _grantCalls.ListAsync(status, cancellationToken); return Ok(calls); } [HttpGet("{grantCallId}")] public async Task> GetById( string grantCallId, CancellationToken cancellationToken) { var call = await _grantCalls.GetAsync(grantCallId, cancellationToken); return call is null ? NotFound() : Ok(call); } }