add: метод контроллера отчета о смещении группы затрат относительно плана
This commit is contained in:
parent
13dbcc5bc1
commit
f800f6cf0e
@ -1,7 +1,7 @@
|
||||
using Contracts.Services;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Services.Support;
|
||||
using Services.Support.Exceptions;
|
||||
|
||||
namespace Controllers.Controllers;
|
||||
|
||||
@ -10,10 +10,13 @@ namespace Controllers.Controllers;
|
||||
public class ReportController : ControllerBase
|
||||
{
|
||||
private readonly IReportPeriodService _reportPeriodService;
|
||||
private readonly IReportOffsetFromPlanService _reportOffsetFromPlanService;
|
||||
|
||||
public ReportController(IReportPeriodService reportPeriodService)
|
||||
public ReportController(IReportPeriodService reportPeriodService,
|
||||
IReportOffsetFromPlanService reportOffsetFromPlanService)
|
||||
{
|
||||
_reportPeriodService = reportPeriodService;
|
||||
_reportOffsetFromPlanService = reportOffsetFromPlanService;
|
||||
}
|
||||
|
||||
[HttpGet("period")]
|
||||
@ -34,4 +37,26 @@ public class ReportController : ControllerBase
|
||||
return StatusCode(500, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("plan/{id}")]
|
||||
public async Task<ActionResult<SpendingGroupViewModel>> GetReportOffsetFromPlan(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var offset = await _reportOffsetFromPlanService.GetReportData(new() { Id = id });
|
||||
return Ok(offset);
|
||||
}
|
||||
catch (ReportDataNotFoundException ex)
|
||||
{
|
||||
return NotFound(ex.Message);
|
||||
}
|
||||
catch (EntityNotFoundException ex)
|
||||
{
|
||||
return NotFound(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user