Refinamiento de permisos y ajustes en controles. Añade gestión sobre saldos y visualización. Entre otros..

This commit is contained in:
2025-06-06 18:33:09 -03:00
parent 8fb94f8cef
commit 35e24ab7d2
104 changed files with 5917 additions and 1205 deletions

View File

@@ -74,6 +74,25 @@ namespace GestionIntegral.Api.Controllers // Ajusta el namespace si es necesario
}
}
// GET: api/empresas/dropdown
[HttpGet("dropdown")]
[ProducesResponseType(typeof(IEnumerable<EmpresaDropdownDto>), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetEmpresasDropdown()
{
try
{
var empresas = await _empresaService.ObtenerParaDropdown();
return Ok(empresas);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error al obtener todas las Empresas.");
return StatusCode(StatusCodes.Status500InternalServerError, "Error interno al obtener las empresas.");
}
}
// GET: api/empresas/{id}
// Permiso Requerido: DE001 (Ver Empresas)
[HttpGet("{id:int}", Name = "GetEmpresaById")]
@@ -101,6 +120,29 @@ namespace GestionIntegral.Api.Controllers // Ajusta el namespace si es necesario
}
}
[HttpGet("{id:int}/lookup", Name = "GetEmpresaLookupById")]
[ProducesResponseType(typeof(EmpresaDto), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> ObtenerLookupPorIdAsync(int id)
{
try
{
var empresa = await _empresaService.ObtenerLookupPorIdAsync(id);
if (empresa == null)
{
return NotFound(new { message = $"Empresa con ID {id} no encontrada." });
}
return Ok(empresa);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error al obtener Empresa por ID: {Id}", id);
return StatusCode(StatusCodes.Status500InternalServerError, "Error interno al obtener la empresa.");
}
}
// POST: api/empresas
// Permiso Requerido: DE002 (Agregar Empresas)
[HttpPost]