sync full source from private myoffice

This commit is contained in:
myoffice-sync
2026-08-05 10:55:09 +00:00
parent 874796c860
commit 405abdfe69
714 changed files with 70352 additions and 234 deletions
@@ -0,0 +1,75 @@
namespace MyOffice.Web.Controllers;
using AutoMapper;
using Core.Extensions;
using Infrastructure.Attributes;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MyOffice.Web.Models.Dashboard;
using Services.Dashboard;
[Authorize]
[ApiController]
[Route("api/dashboard")]
[DefaultFromBody]
public class DashboardController : BaseApiController
{
private readonly ILogger<DashboardController> _logger;
private readonly DashboardService _dashboardService;
private readonly IMapper _mapper;
public DashboardController(
ILogger<DashboardController> logger,
DashboardService dashboardService,
IMapper mapper
)
{
_logger = logger;
_dashboardService = dashboardService;
_mapper = mapper;
}
[HttpGet]
public async Task<ObjectResult> Index(CancellationToken cancellationToken)
{
var data = await _dashboardService.GetDashboardRestDataAsync(UserId, cancellationToken);
return OkResponse(_mapper.Map<DashboardViewModel>(data));
}
[HttpGet("income")]
public async Task<ObjectResult> Income(
DateTime from,
DateTime to,
[AsGuid(true)] string? category,
CancellationToken cancellationToken
)
{
var data = await _dashboardService.GetDashboardIncomeDataAsync(
UserId,
from.StartOfDay(),
to.EndOfDay(),
category?.AsGuidNull(),
cancellationToken);
return OkResponse(_mapper.Map<DashboardIncomeDataViewModel>(data));
}
[HttpGet("outcome")]
public async Task<ObjectResult> Outcome(
DateTime from,
DateTime to,
[AsGuid(true)] string? category,
CancellationToken cancellationToken
)
{
var data = await _dashboardService.GetDashboardOutcomeDataAsync(
UserId,
from.StartOfDay(),
to.EndOfDay(),
category?.AsGuidNull(),
cancellationToken);
return OkResponse(_mapper.Map<DashboardIncomeDataViewModel>(data));
}
}