2026-04-16 19:25:42 -04:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2026-07-24 17:35:34 -03:00
|
|
|
using SeaHaven.Services.Interfaces;
|
2026-04-16 19:25:42 -04:00
|
|
|
|
|
|
|
|
namespace Api.SeaHavenIndustries.Controllers
|
|
|
|
|
{
|
|
|
|
|
[Authorize]
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
public class DashboardController : Controller
|
|
|
|
|
{
|
2026-07-24 17:35:34 -03:00
|
|
|
private readonly IDashboardService _dashboardService;
|
2026-04-16 19:25:42 -04:00
|
|
|
|
2026-07-24 17:35:34 -03:00
|
|
|
public DashboardController(IDashboardService dashboardService)
|
2026-04-16 19:25:42 -04:00
|
|
|
{
|
2026-07-24 17:35:34 -03:00
|
|
|
_dashboardService = dashboardService;
|
2026-04-16 19:25:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet("Stats")]
|
2026-07-24 17:35:34 -03:00
|
|
|
public async Task<IActionResult> GetStats(CancellationToken cancellationToken)
|
2026-04-16 19:25:42 -04:00
|
|
|
{
|
2026-07-24 17:35:34 -03:00
|
|
|
var stats = await _dashboardService.GetStatsAsync(cancellationToken);
|
2026-04-16 19:25:42 -04:00
|
|
|
|
|
|
|
|
return Ok(new
|
|
|
|
|
{
|
2026-07-24 17:35:34 -03:00
|
|
|
total = stats.Total,
|
|
|
|
|
open = stats.Open,
|
|
|
|
|
notDispatched = stats.NotDispatched,
|
|
|
|
|
completed = stats.Completed
|
2026-04-16 19:25:42 -04:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|