mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 09:33:13 +00:00
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SeaHaven.Services.DTOs;
|
|
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(
|
|
[FromQuery] DashboardStatsQueryDTO query,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var stats = await _dashboardService.GetStatsAsync(User, query, cancellationToken);
|
|
|
|
return Ok(new
|
|
{
|
|
total = stats.Total,
|
|
open = stats.Open,
|
|
notDispatched = stats.NotDispatched,
|
|
completed = stats.Completed,
|
|
breakdown = stats.Breakdown,
|
|
dueCount = stats.DueCount,
|
|
completedDueCount = stats.CompletedDueCount,
|
|
completionRate = stats.CompletionRate,
|
|
averageResolutionDays = stats.AverageResolutionDays
|
|
});
|
|
}
|
|
}
|
|
}
|