feat(application): repository abstraction + DTOs + validators + handlers CRUD PuntosDeVenta con auditoría + retry deadlock

This commit is contained in:
2026-04-17 12:28:11 -03:00
parent 43877bd4a1
commit 50f6f2b67a
36 changed files with 1296 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using FluentValidation;
namespace SIGCM2.Application.PuntosDeVenta.Create;
public sealed class CreatePuntoDeVentaCommandValidator : AbstractValidator<CreatePuntoDeVentaCommand>
{
private const int NombreMaxLength = 100;
private const int DescripcionMaxLength = 255;
private const short NumeroAFIPMin = 1;
private const short NumeroAFIPMax = 9999;
public CreatePuntoDeVentaCommandValidator()
{
RuleFor(x => x.MedioId)
.GreaterThan(0).WithMessage("El medioId debe ser mayor a 0.");
RuleFor(x => x.NumeroAFIP)
.InclusiveBetween(NumeroAFIPMin, NumeroAFIPMax)
.WithMessage($"El número AFIP debe estar entre {NumeroAFIPMin} y {NumeroAFIPMax}.");
RuleFor(x => x.Nombre)
.NotEmpty().WithMessage("El nombre es requerido.")
.MaximumLength(NombreMaxLength).WithMessage($"El nombre no puede superar los {NombreMaxLength} caracteres.");
RuleFor(x => x.Descripcion)
.MaximumLength(DescripcionMaxLength).WithMessage($"La descripción no puede superar los {DescripcionMaxLength} caracteres.")
.When(x => x.Descripcion is not null);
}
}