Feat: Se agregan servicios y controladores para ABM de suscriptores

This commit is contained in:
2025-07-30 09:48:05 -03:00
parent 19e7192a16
commit f09c795fb0
13 changed files with 623 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
namespace GestionIntegral.Api.Dtos.Suscripciones
{
public class CreateSuscripcionDto
{
[Required]
public int IdSuscriptor { get; set; }
[Required]
public int IdPublicacion { get; set; }
[Required]
public DateTime FechaInicio { get; set; }
public DateTime? FechaFin { get; set; }
[Required]
public string Estado { get; set; } = "Activa";
[Required(ErrorMessage = "Debe especificar los días de entrega.")]
public List<string> DiasEntrega { get; set; } = new List<string>(); // "L", "M", "X"...
[StringLength(250)]
public string? Observaciones { get; set; }
}
}
// Nota: Por ahora, el DTO de actualización puede ser similar al de creación.
// Si se necesita una lógica diferente, se crearía un UpdateSuscripcionDto.

View File

@@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
namespace GestionIntegral.Api.Dtos.Suscripciones
{
public class CreateSuscriptorDto
{
[Required(ErrorMessage = "El nombre completo es obligatorio.")]
[StringLength(150)]
public string NombreCompleto { get; set; } = string.Empty;
[EmailAddress(ErrorMessage = "El formato del email no es válido.")]
[StringLength(100)]
public string? Email { get; set; }
[StringLength(50)]
public string? Telefono { get; set; }
[Required(ErrorMessage = "La dirección es obligatoria.")]
[StringLength(200)]
public string Direccion { get; set; } = string.Empty;
[Required(ErrorMessage = "El tipo de documento es obligatorio.")]
[StringLength(4)]
public string TipoDocumento { get; set; } = string.Empty;
[Required(ErrorMessage = "El número de documento es obligatorio.")]
[StringLength(11)]
public string NroDocumento { get; set; } = string.Empty;
[StringLength(22, MinimumLength = 22, ErrorMessage = "El CBU debe tener 22 dígitos.")]
public string? CBU { get; set; }
[Required(ErrorMessage = "La forma de pago es obligatoria.")]
public int IdFormaPagoPreferida { get; set; }
[StringLength(250)]
public string? Observaciones { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace GestionIntegral.Api.Dtos.Suscripciones
{
public class FormaPagoDto
{
public int IdFormaPago { get; set; }
public string Nombre { get; set; } = string.Empty;
public bool RequiereCBU { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace GestionIntegral.Api.Dtos.Suscripciones
{
public class SuscripcionDto
{
public int IdSuscripcion { get; set; }
public int IdSuscriptor { get; set; }
public int IdPublicacion { get; set; }
public string NombrePublicacion { get; set; } = string.Empty; // Para UI
public string FechaInicio { get; set; } = string.Empty; // Formato "yyyy-MM-dd"
public string? FechaFin { get; set; }
public string Estado { get; set; } = string.Empty;
public string DiasEntrega { get; set; } = string.Empty;
public string? Observaciones { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
namespace GestionIntegral.Api.Dtos.Suscripciones
{
// DTO para mostrar la información de un suscriptor
public class SuscriptorDto
{
public int IdSuscriptor { get; set; }
public string NombreCompleto { get; set; } = string.Empty;
public string? Email { get; set; }
public string? Telefono { get; set; }
public string Direccion { get; set; } = string.Empty;
public string TipoDocumento { get; set; } = string.Empty;
public string NroDocumento { get; set; } = string.Empty;
public string? CBU { get; set; }
public int IdFormaPagoPreferida { get; set; }
public string NombreFormaPagoPreferida { get; set; } = string.Empty; // Para UI
public string? Observaciones { get; set; }
public bool Activo { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using System.ComponentModel.DataAnnotations;
namespace GestionIntegral.Api.Dtos.Suscripciones
{
// Es idéntico al CreateDto, pero se mantiene separado por si las reglas de validación cambian.
public class UpdateSuscriptorDto
{
[Required(ErrorMessage = "El nombre completo es obligatorio.")]
[StringLength(150)]
public string NombreCompleto { get; set; } = string.Empty;
[EmailAddress(ErrorMessage = "El formato del email no es válido.")]
[StringLength(100)]
public string? Email { get; set; }
[StringLength(50)]
public string? Telefono { get; set; }
[Required(ErrorMessage = "La dirección es obligatoria.")]
[StringLength(200)]
public string Direccion { get; set; } = string.Empty;
[Required(ErrorMessage = "El tipo de documento es obligatorio.")]
[StringLength(4)]
public string TipoDocumento { get; set; } = string.Empty;
[Required(ErrorMessage = "El número de documento es obligatorio.")]
[StringLength(11)]
public string NroDocumento { get; set; } = string.Empty;
[StringLength(22, MinimumLength = 22, ErrorMessage = "El CBU debe tener 22 dígitos.")]
public string? CBU { get; set; }
[Required(ErrorMessage = "La forma de pago es obligatoria.")]
public int IdFormaPagoPreferida { get; set; }
[StringLength(250)]
public string? Observaciones { get; set; }
}
}