feat(domain): Rubro entity + domain exceptions (CAT-001)

This commit is contained in:
2026-04-18 19:17:33 -03:00
parent 9f78425a93
commit dcb2e5ada6
10 changed files with 620 additions and 0 deletions

View File

@@ -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;
}
}