File size: 1,249 Bytes
de8b914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SCM.Application.Medicao;
using SCM.Shared.Api;
using SCM.Shared.Constants;

namespace SCM.Api.Controllers;

/// <summary>Faturamento físico-financeiro por EAP (read-model JSON; tipos F/P/J; PDF adiado).</summary>
[ApiController]
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}")]
[Authorize]
[Produces("application/json")]
public sealed class FaturamentosController : ControllerBase
{
    private readonly IFaturamentoService _service;

    public FaturamentosController(IFaturamentoService service) => _service = service;

    /// <summary>Relatório de faturamento do contrato: valor previsto e apropriado por EAP×item.</summary>
    [HttpGet("contratos/{contratoId:guid}/faturamento")]
    [Authorize(Roles = Roles.Administrador + "," + Roles.Gestor + "," + Roles.Engenheiro)]
    [ProducesResponseType(typeof(FaturamentoResponse), StatusCodes.Status200OK)]
    [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status404NotFound)]
    public async Task<ActionResult<FaturamentoResponse>> GetFaturamento(
        Guid contratoId, CancellationToken ct = default)
        => Ok(await _service.GetFaturamentoAsync(contratoId, ct));
}