2026-04-18 19:25:35 -03:00
|
|
|
using SIGCM2.Application.Abstractions;
|
|
|
|
|
using SIGCM2.Application.Abstractions.Persistence;
|
|
|
|
|
using SIGCM2.Application.Rubros.Common;
|
|
|
|
|
using SIGCM2.Application.Rubros.Dtos;
|
|
|
|
|
|
|
|
|
|
namespace SIGCM2.Application.Rubros.GetTree;
|
|
|
|
|
|
|
|
|
|
public sealed class GetRubroTreeQueryHandler : ICommandHandler<GetRubroTreeQuery, IReadOnlyList<RubroTreeNodeDto>>
|
|
|
|
|
{
|
|
|
|
|
private readonly IRubroRepository _repo;
|
|
|
|
|
|
|
|
|
|
public GetRubroTreeQueryHandler(IRubroRepository repo)
|
|
|
|
|
{
|
|
|
|
|
_repo = repo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IReadOnlyList<RubroTreeNodeDto>> Handle(GetRubroTreeQuery query)
|
|
|
|
|
{
|
|
|
|
|
var all = await _repo.GetAllAsync(query.IncluirInactivos);
|
2026-04-19 08:20:36 -03:00
|
|
|
// CAT-002: avisoCounts injected via IAvisoQueryRepository (wired in Batch 6)
|
|
|
|
|
return RubroTreeBuilder.Build(all, query.IncluirInactivos, new Dictionary<int, int>());
|
2026-04-18 19:25:35 -03:00
|
|
|
}
|
|
|
|
|
}
|