feat(domain): RubroConProductosActivosException + test (closes #41)
Co-authored-by: fix/issue-41-rubro-deactivation-guard
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
namespace SIGCM2.Domain.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when attempting to soft-delete a Rubro that still has active Products referencing it via RubroId. → HTTP 409
|
||||
/// </summary>
|
||||
public sealed class RubroConProductosActivosException : DomainException
|
||||
{
|
||||
public int RubroId { get; }
|
||||
public int ProductosActivosCount { get; }
|
||||
|
||||
public RubroConProductosActivosException(int rubroId, int productosActivosCount)
|
||||
: base($"No se puede desactivar el rubro {rubroId}: tiene {productosActivosCount} producto(s) activo(s) referenciándolo.")
|
||||
{
|
||||
RubroId = rubroId;
|
||||
ProductosActivosCount = productosActivosCount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user