fix: отчеты за период

This commit is contained in:
mfnefd 2024-12-11 04:02:26 +04:00
parent c9852a5384
commit e97902084f
3 changed files with 6 additions and 6 deletions

View File

@ -4,5 +4,5 @@ namespace Contracts.Services;
public interface IReportPeriodService public interface IReportPeriodService
{ {
Task<IEnumerable<ChangeRecordViewModel>> GetReportData(DateTime from, DateTime to); Task<IEnumerable<ChangeRecordViewModel>> GetReportData(DateTime from, DateTime to, Guid userId);
} }

View File

@ -19,13 +19,13 @@ public class ReportController : ControllerBase
_reportOffsetFromPlanService = reportOffsetFromPlanService; _reportOffsetFromPlanService = reportOffsetFromPlanService;
} }
[HttpGet("period")] [HttpGet("period/{id}")]
public async Task<ActionResult<IEnumerable<ChangeRecordViewModel>>> GetReportData( public async Task<ActionResult<IEnumerable<ChangeRecordViewModel>>> GetReportData(
[FromQuery] DateTime from, [FromQuery] DateTime to) [FromQuery] DateTime from, [FromQuery] DateTime to, Guid id)
{ {
try try
{ {
var periodData = await _reportPeriodService.GetReportData(from, to); var periodData = await _reportPeriodService.GetReportData(from, to, id);
return Ok(periodData); return Ok(periodData);
} }
catch (ReportDataNotFoundException ex) catch (ReportDataNotFoundException ex)

View File

@ -16,9 +16,9 @@ public class ReportPeriodService : IReportPeriodService
_changeRecordRepo = changeRecordRepo; _changeRecordRepo = changeRecordRepo;
} }
public async Task<IEnumerable<ChangeRecordViewModel>> GetReportData(DateTime from, DateTime to) public async Task<IEnumerable<ChangeRecordViewModel>> GetReportData(DateTime from, DateTime to, Guid userId)
{ {
var records = await _changeRecordRepo.GetList(new ChangeRecordSearch() { From = from, To = to }); var records = await _changeRecordRepo.GetList(new ChangeRecordSearch() { From = from, To = to, UserId = userId });
if (!records.Any()) if (!records.Any())
{ {