const dbApp = require("../modelsapp/db").default;
const { QueryTypes } = require("sequelize");
const getInventarios = async () => {
try {
const connection = await DBConnection();
/*
you can access the where variable via the params object
for instance:
params.where
params.limit
params.offset
You can also have access to the user variable data:
options.session
*/
const response = await connection.query(
`
SELECT CANT, LOTE, FVTO
FROM ZZL_VIEW_NIVIEL_INVENTARIO_LOTE
WHERE REF = '${params.where.REF}'
ORDER BY FVTO ASC;
`,
{
type: QueryTypes.SELECT
}
);
return {
items: response,
total: response.length,
};
} catch (error) {
console.error("Error en getInventarios:", error);
throw new Error(JSON.stringify(error.message));
}
};
getInventarios();