feat: Implement Day End Report feature logic

This commit is contained in:
2026-10-23 14:52:39 +05:30
parent c775146b64
commit 6674ba6aae
5 changed files with 224 additions and 0 deletions
@@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Mvc;
namespace Distribution.Features.DayEndReport;
[ApiController]
[Route("api/reports/day-end")]
public class DayEndReportController(DayEndReportService service) : ControllerBase
{
[HttpGet]
public async Task<IActionResult> Day([FromQuery] DateTime? date) =>
Ok(await service.GetDayAsync(date ?? DateTime.Now));
[HttpGet("daily")]
public async Task<IActionResult> Daily([FromQuery] DateTime? from, [FromQuery] DateTime? to)
{
var f = DayEndReportService.BuildFilter(from, to);
var error = DayEndReportService.Validate(f);
return error is null ? Ok(await service.GetDailyAsync(f)) : BadRequest(new { message = error });
}
}