using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Threading.Tasks; using TaskTrackingSystem.Shared; using TaskTrackingSystem.Shared.Models.Dashboard; using TaskTrackingSystem.WebApi.Infrastructure; namespace TaskTrackingSystem.WebApi.Features.Dashboard { [Route("api/[controller]")] [ApiController] [Authorize] public class DashboardController : ControllerBase { private readonly DashboardService _dashboardService; public DashboardController(DashboardService dashboardService) { _dashboardService = dashboardService; } [HttpGet("summary")] public async Task>> GetSummary() { var result = await _dashboardService.GetSummaryAsync(User.GetRoleId(), User.GetUserId()); return StatusCode(result.StatusCode, result); } [HttpGet("tasks-overview")] public async Task>>> GetTasksOverview() { var result = await _dashboardService.GetTasksOverviewAsync(User.GetRoleId(), User.GetUserId()); return StatusCode(result.StatusCode, result); } [HttpGet("project-progress")] public async Task>>> GetProjectProgress() { var result = await _dashboardService.GetProjectProgressAsync(User.GetRoleId(), User.GetUserId()); return StatusCode(result.StatusCode, result); } } }