Implementar sistema completo de trazabilidad de lotes
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m47s

- Agregar PostgreSQL 16 con esquema completo
- Crear API endpoints para lotes y operaciones
- Implementar UI con Nuxt UI (tablas, formularios, trazabilidad)
- Agregar datos de ejemplo del flujo completo
- Documentar sistema en PLAN_TRAZABILIDAD.md
This commit is contained in:
2025-11-21 18:39:04 -06:00
parent e5456bf522
commit ee3dffa38e
26 changed files with 4223 additions and 74 deletions

View File

@@ -0,0 +1,44 @@
import { getOperacionConLotes } from '~/server/utils/queries'
/**
* GET /api/operaciones/:id
* Obtiene una operación específica con sus lotes relacionados (inputs y outputs)
*/
export default defineEventHandler(async (event) => {
try {
const id = getRouterParam(event, 'id')
if (!id) {
throw createError({
statusCode: 400,
statusMessage: 'ID de operación requerido',
})
}
const operacion = await getOperacionConLotes(id)
if (!operacion) {
throw createError({
statusCode: 404,
statusMessage: 'Operación no encontrada',
})
}
return {
success: true,
data: operacion,
}
} catch (error: any) {
console.error('Error obteniendo operación:', error)
if (error.statusCode) {
throw error
}
throw createError({
statusCode: 500,
statusMessage: 'Error obteniendo operación',
data: { message: error.message },
})
}
})