Implementación AnomalIA - Fix de dropdowns y permisos.
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 5m17s

This commit is contained in:
2025-06-30 15:26:14 -03:00
parent 95aa09d62a
commit c96d259892
59 changed files with 1430 additions and 337 deletions

View File

@@ -33,7 +33,6 @@ namespace GestionIntegral.Api.Services.Distribucion
_logger = logger;
}
// CORREGIDO: MapToDto ahora acepta una tupla con tipos anulables
private CanillaDto? MapToDto((Canilla? Canilla, string? NombreZona, string? NombreEmpresa) data)
{
if (data.Canilla == null) return null;
@@ -62,10 +61,14 @@ namespace GestionIntegral.Api.Services.Distribucion
return data.Select(MapToDto).Where(dto => dto != null).Select(dto => dto!);
}
public async Task<IEnumerable<CanillaDropdownDto>> ObtenerTodosDropdownAsync(bool? esAccionista, bool? soloActivos)
{
return await _canillaRepository.GetAllDropdownAsync(esAccionista, soloActivos) ?? Enumerable.Empty<CanillaDropdownDto>();
}
public async Task<CanillaDto?> ObtenerPorIdAsync(int id)
{
var data = await _canillaRepository.GetByIdAsync(id);
// MapToDto ahora devuelve CanillaDto? así que esto es correcto
return MapToDto(data);
}
@@ -89,7 +92,6 @@ namespace GestionIntegral.Api.Services.Distribucion
}
}
// CORREGIDO: Usar directamente el valor booleano
if (createDto.Accionista == true && createDto.Empresa != 0)
{
return (null, "Un canillita accionista no debe tener una empresa asignada (Empresa debe ser 0).");
@@ -287,6 +289,6 @@ namespace GestionIntegral.Api.Services.Distribucion
FechaMod = h.Historial.FechaMod,
TipoMod = h.Historial.TipoMod
}).ToList();
}
}
}
}

View File

@@ -8,6 +8,7 @@ namespace GestionIntegral.Api.Services.Distribucion
public interface ICanillaService
{
Task<IEnumerable<CanillaDto>> ObtenerTodosAsync(string? nomApeFilter, int? legajoFilter, bool? esAccionista, bool? soloActivos);
Task<IEnumerable<CanillaDropdownDto>> ObtenerTodosDropdownAsync(bool? esAccionista, bool? soloActivos);
Task<CanillaDto?> ObtenerPorIdAsync(int id);
Task<(CanillaDto? Canilla, string? Error)> CrearAsync(CreateCanillaDto createDto, int idUsuario);
Task<(bool Exito, string? Error)> ActualizarAsync(int id, UpdateCanillaDto updateDto, int idUsuario);

View File

@@ -8,6 +8,7 @@ namespace GestionIntegral.Api.Services.Distribucion
public interface IOtroDestinoService
{
Task<IEnumerable<OtroDestinoDto>> ObtenerTodosAsync(string? nombreFilter);
Task<IEnumerable<OtroDestinoDropdownDto>> ObtenerTodosDropdownAsync();
Task<OtroDestinoDto?> ObtenerPorIdAsync(int id);
Task<(OtroDestinoDto? Destino, string? Error)> CrearAsync(CreateOtroDestinoDto createDto, int idUsuario);
Task<(bool Exito, string? Error)> ActualizarAsync(int id, UpdateOtroDestinoDto updateDto, int idUsuario);

View File

@@ -37,6 +37,11 @@ namespace GestionIntegral.Api.Services.Distribucion
return destinos.Select(MapToDto);
}
public async Task<IEnumerable<OtroDestinoDropdownDto>> ObtenerTodosDropdownAsync()
{
return await _otroDestinoRepository.GetAllDropdownAsync();
}
public async Task<OtroDestinoDto?> ObtenerPorIdAsync(int id)
{
var destino = await _otroDestinoRepository.GetByIdAsync(id);

View File

@@ -86,6 +86,7 @@ namespace GestionIntegral.Api.Services.Distribucion
{
IdPublicacion = d.Publicacion!.IdPublicacion, // Usar ! si estás seguro que no es null después del Where
Nombre = d.Publicacion!.Nombre,
NombreEmpresa = d.NombreEmpresa ?? "Empresa Desconocida",
Habilitada = d.Publicacion!.Habilitada ?? true // Si necesitas filtrar por esto
})
.OrderBy(p => p.Nombre)