feat(domain): ProductPrice entity + exceptions (PRD-003)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
namespace SIGCM2.Domain.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when attempting to add a ProductPrice with a PriceValidFrom that is not strictly
|
||||
/// greater than the currently active price's PriceValidFrom. → HTTP 409
|
||||
/// </summary>
|
||||
public sealed class ProductPriceForwardOnlyException : DomainException
|
||||
{
|
||||
public int ProductId { get; }
|
||||
public DateOnly NewPriceValidFrom { get; }
|
||||
public DateOnly ActivePriceValidFrom { get; }
|
||||
|
||||
public ProductPriceForwardOnlyException(
|
||||
int productId,
|
||||
DateOnly newPriceValidFrom,
|
||||
DateOnly activePriceValidFrom)
|
||||
: base($"El nuevo PriceValidFrom ({newPriceValidFrom:yyyy-MM-dd}) debe ser estrictamente mayor al PriceValidFrom del precio activo ({activePriceValidFrom:yyyy-MM-dd}).")
|
||||
{
|
||||
ProductId = productId;
|
||||
NewPriceValidFrom = newPriceValidFrom;
|
||||
ActivePriceValidFrom = activePriceValidFrom;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user