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,37 @@
import { getLotes } from '~/server/utils/queries'
/**
* GET /api/lotes
* Lista todos los lotes con filtros opcionales
*
* Query params:
* - tipo: filtrar por tipo de lote (uva, despulpado_primera, oreado, etc.)
* - limit: límite de resultados
* - offset: offset para paginación
*/
export default defineEventHandler(async (event) => {
try {
const query = getQuery(event)
const filtros = {
tipo: query.tipo as string | undefined,
limit: query.limit ? parseInt(query.limit as string) : undefined,
offset: query.offset ? parseInt(query.offset as string) : undefined,
}
const lotes = await getLotes(filtros)
return {
success: true,
data: lotes,
count: lotes.length,
}
} catch (error: any) {
console.error('Error obteniendo lotes:', error)
throw createError({
statusCode: 500,
statusMessage: 'Error obteniendo lotes',
data: { message: error.message },
})
}
})