18 lines
627 B
C#
18 lines
627 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Distribution.Features.PaymentReport;
|
|
|
|
[ApiController]
|
|
[Route("api/reports/payments")]
|
|
public class PaymentReportController(PaymentReportService service) : ControllerBase
|
|
{
|
|
[HttpGet("analytics")]
|
|
public async Task<IActionResult> Analytics(
|
|
[FromQuery] DateTime? from, [FromQuery] DateTime? to, [FromQuery] Guid? regionId)
|
|
{
|
|
var f = PaymentReportService.BuildFilter(from, to, regionId);
|
|
var error = PaymentReportService.Validate(f);
|
|
return error is null ? Ok(await service.GetAnalyticsAsync(f)) : BadRequest(new { message = error });
|
|
}
|
|
}
|