feat(application): DeactivateRubroCommandHandler guard contra Products activos
Extiende IProductQueryRepository con CountActiveByRubroAsync, inyecta el repositorio en el handler e intercala el chequeo después del guard de hijos activos. Tests de unidad cubren: throw, success con 0 productos, y estabilidad del orden de guardas (hijos primero).
This commit is contained in:
@@ -12,4 +12,10 @@ public interface IProductQueryRepository
|
||||
/// Used by DeactivateProductTypeCommandHandler to guard against orphaning active products.
|
||||
/// </summary>
|
||||
Task<bool> ExistsActiveByProductTypeAsync(int productTypeId, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the count of active Products where RubroId = rubroId.
|
||||
/// Used by DeactivateRubroCommandHandler to guard against orphaning active products. (issue #41)
|
||||
/// </summary>
|
||||
Task<int> CountActiveByRubroAsync(int rubroId, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user