mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 08:23:12 +00:00
33 lines
943 B
C#
33 lines
943 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SeaHaven.Services.Interfaces;
|
|
|
|
namespace Api.SeaHavenIndustries.Controllers
|
|
{
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class DashboardController : Controller
|
|
{
|
|
private readonly IDashboardService _dashboardService;
|
|
|
|
public DashboardController(IDashboardService dashboardService)
|
|
{
|
|
_dashboardService = dashboardService;
|
|
}
|
|
|
|
[HttpGet("Stats")]
|
|
public async Task<IActionResult> GetStats(CancellationToken cancellationToken)
|
|
{
|
|
var stats = await _dashboardService.GetStatsAsync(User, cancellationToken);
|
|
|
|
return Ok(new
|
|
{
|
|
total = stats.Total,
|
|
open = stats.Open,
|
|
notDispatched = stats.NotDispatched,
|
|
completed = stats.Completed
|
|
});
|
|
}
|
|
}
|
|
}
|