Feat: Cambios Varios 2

This commit is contained in:
2026-01-05 10:30:04 -03:00
parent 8bc1308bc5
commit 0fa77e4a98
184 changed files with 11098 additions and 6348 deletions

View File

@@ -0,0 +1,11 @@
namespace SIGCM.Application.DTOs;
public class AuthResult
{
public bool Success { get; set; }
public string? Token { get; set; }
public string? ErrorMessage { get; set; }
public bool IsLockedOut { get; set; }
public bool RequiresPasswordChange { get; set; }
public bool RequiresMfa { get; set; }
}

View File

@@ -0,0 +1,42 @@
namespace SIGCM.Application.DTOs;
// DTO para iniciar el cierre de caja (arqueo ciego)
public class CashClosingDto
{
public decimal DeclaredCash { get; set; }
public decimal DeclaredDebit { get; set; }
public decimal DeclaredCredit { get; set; }
public decimal DeclaredTransfer { get; set; }
public string? Notes { get; set; }
}
// DTO de respuesta con el resultado del cierre
public class CashClosingResultDto
{
public int ClosingId { get; set; }
// Valores declarados por el cajero
public decimal DeclaredCash { get; set; }
public decimal DeclaredDebit { get; set; }
public decimal DeclaredCredit { get; set; }
public decimal DeclaredTransfer { get; set; }
public decimal TotalDeclared { get; set; }
// Valores reales del sistema
public decimal SystemCash { get; set; }
public decimal SystemDebit { get; set; }
public decimal SystemCredit { get; set; }
public decimal SystemTransfer { get; set; }
public decimal TotalSystem { get; set; }
// Diferencias detectadas
public decimal CashDifference { get; set; }
public decimal DebitDifference { get; set; }
public decimal CreditDifference { get; set; }
public decimal TransferDifference { get; set; }
public decimal TotalDifference { get; set; }
// Banderas de estado
public bool HasDiscrepancies { get; set; }
public string? Message { get; set; }
}

View File

@@ -1,28 +1,43 @@
// src/SIGCM.Application/DTOs/ListingDtos.cs
namespace SIGCM.Application.DTOs;
public class CreateListingDto
{
public int CategoryId { get; set; }
public int OperationId { get; set; }
public required string Title { get; set; }
public string Title { get; set; } = string.Empty;
public string? Description { get; set; }
public decimal Price { get; set; }
public decimal AdFee { get; set; }
public string Status { get; set; } = "Draft";
public string Currency { get; set; } = "ARS";
public int? UserId { get; set; }
public Dictionary<int, string> Attributes { get; set; } = new();
public string? PrintText { get; set; }
public string? PrintFontSize { get; set; }
public string? PrintAlignment { get; set; }
public int PrintDaysCount { get; set; }
public int? ClientId { get; set; }
public string? ClientName { get; set; }
public string? ClientDni { get; set; }
public string Origin { get; set; } = "Mostrador";
public List<string>? ImagesToClone { get; set; }
// Impresión
public string? PrintText { get; set; }
public DateTime? PrintStartDate { get; set; }
public int PrintDaysCount { get; set; }
public bool IsBold { get; set; }
public bool IsFrame { get; set; }
public string PrintFontSize { get; set; } = "normal";
public string PrintAlignment { get; set; } = "left";
// Atributos Dinámicos
public Dictionary<int, string> Attributes { get; set; } = new();
// Pagos
public List<PaymentDto>? Payments { get; set; }
}
public class ListingDto : CreateListingDto
{
public int Id { get; set; }
public DateTime CreatedAt { get; set; }
public required string Status { get; set; }
}
public class ListingDetailDto : ListingDto
@@ -35,14 +50,22 @@ public class ListingAttributeDto
{
public int ListingId { get; set; }
public int AttributeDefinitionId { get; set; }
public required string AttributeName { get; set; }
public required string Value { get; set; }
public string AttributeName { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
}
public class ListingImageDto
{
public int Id { get; set; }
public required string Url { get; set; }
public string Url { get; set; } = string.Empty;
public bool IsMainInfo { get; set; }
public int DisplayOrder { get; set; }
}
}
public class PaymentDto
{
public decimal Amount { get; set; }
public string PaymentMethod { get; set; } = string.Empty;
public string? CardPlan { get; set; }
public decimal Surcharge { get; set; }
}

View File

@@ -2,5 +2,15 @@ namespace SIGCM.Application.Interfaces;
public interface IAuthService
{
Task<string?> LoginAsync(string username, string password);
// Autenticación estándar
Task<DTOs.AuthResult> LoginAsync(string username, string password);
Task<DTOs.AuthResult> RegisterAsync(string username, string email, string password);
// Autenticación social (Google)
Task<DTOs.AuthResult> GoogleLoginAsync(string idToken);
// Seguridad avanzada (MFA)
Task<string> GenerateMfaSecretAsync(int userId);
Task<bool> VerifyMfaCodeAsync(int userId, string code);
Task EnableMfaAsync(int userId, bool enabled);
}

View File

@@ -4,6 +4,10 @@
<ProjectReference Include="..\SIGCM.Domain\SIGCM.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="12.1.1" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>

View File

@@ -0,0 +1,53 @@
using FluentValidation;
using SIGCM.Application.DTOs;
namespace SIGCM.Application.Validators;
public class CreateListingDtoValidator : AbstractValidator<CreateListingDto>
{
public CreateListingDtoValidator()
{
RuleFor(x => x.CategoryId)
.GreaterThan(0)
.WithMessage("Debe seleccionar un rubro válido.");
RuleFor(x => x.OperationId)
.GreaterThan(0)
.WithMessage("Debe seleccionar una operación válida.");
RuleFor(x => x.PrintText)
.NotEmpty()
.WithMessage("El texto del aviso no puede estar vacío.")
.MinimumLength(10)
.WithMessage("El texto del aviso es demasiado corto (mínimo 10 caracteres).");
RuleFor(x => x.PrintDaysCount)
.InclusiveBetween(1, 365)
.WithMessage("La duración debe ser entre 1 y 365 días.");
RuleFor(x => x.AdFee)
.GreaterThanOrEqualTo(0)
.WithMessage("El costo del aviso no puede ser negativo.");
RuleFor(x => x.ClientDni)
.NotEmpty()
.When(x => !string.IsNullOrEmpty(x.ClientName))
.WithMessage("Si especifica un nombre de cliente, el DNI/CUIT es obligatorio.");
RuleForEach(x => x.Payments).SetValidator(new PaymentDtoValidator());
}
}
public class PaymentDtoValidator : AbstractValidator<PaymentDto>
{
public PaymentDtoValidator()
{
RuleFor(x => x.Amount)
.GreaterThan(0)
.WithMessage("El monto del pago debe ser mayor a 0.");
RuleFor(x => x.PaymentMethod)
.NotEmpty()
.WithMessage("Debe especificar un medio de pago.");
}
}