feat(udt-011): T400.10 — inject TimeProvider into all Application handlers

All command handlers that call domain mutators now inject TimeProvider
via constructor and use _timeProvider.GetUtcNow().UtcDateTime as the
explicit 'now' argument. Replaces previous direct DateTime.UtcNow usage.
This commit is contained in:
2026-04-18 10:12:17 -03:00
parent 4e1d8f69ab
commit d69da5ff4c
27 changed files with 164 additions and 59 deletions

View File

@@ -13,15 +13,18 @@ public sealed class ReactivatePuntoDeVentaCommandHandler : ICommandHandler<React
private readonly IPuntoDeVentaRepository _repo;
private readonly IMedioRepository _medioRepo;
private readonly IAuditLogger _audit;
private readonly TimeProvider _timeProvider;
public ReactivatePuntoDeVentaCommandHandler(
IPuntoDeVentaRepository repo,
IMedioRepository medioRepo,
IAuditLogger audit)
IAuditLogger audit,
TimeProvider timeProvider)
{
_repo = repo;
_medioRepo = medioRepo;
_audit = audit;
_timeProvider = timeProvider;
}
public async Task<PuntoDeVentaStatusDto> Handle(ReactivatePuntoDeVentaCommand command)
@@ -39,7 +42,8 @@ public sealed class ReactivatePuntoDeVentaCommandHandler : ICommandHandler<React
if (target.Activo)
return new PuntoDeVentaStatusDto(target.Id, target.NumeroAFIP, target.Activo);
var updated = target.WithActivo(true);
var now = _timeProvider.GetUtcNow().UtcDateTime;
var updated = target.WithActivo(true, now);
using var tx = new TransactionScope(
TransactionScopeOption.Required,