feat(domain): Rubro entity + domain exceptions (CAT-001)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace SIGCM2.Domain.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when a Rubro with the same Nombre (CI) already exists under the same parent. → HTTP 409
|
||||
/// </summary>
|
||||
public sealed class RubroNombreDuplicadoEnPadreException : DomainException
|
||||
{
|
||||
public string Nombre { get; }
|
||||
public int? ParentId { get; }
|
||||
|
||||
public RubroNombreDuplicadoEnPadreException(string nombre, int? parentId)
|
||||
: base(parentId.HasValue
|
||||
? $"Ya existe un rubro con el nombre '{nombre}' bajo el padre con id '{parentId}'."
|
||||
: $"Ya existe un rubro raíz con el nombre '{nombre}'.")
|
||||
{
|
||||
Nombre = nombre;
|
||||
ParentId = parentId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user