19 lines
451 B
JavaScript
19 lines
451 B
JavaScript
const Pregunta = require('../../db/tablas/Pregunta');
|
|
const validar = require('../../helper/validar');
|
|
|
|
const traerPoridSeccion = async (query) => {
|
|
const idSeccion = validar.validarNumeroEntero(
|
|
query.idSeccion,
|
|
'idSeccion'
|
|
);
|
|
|
|
return Pregunta.findAll({
|
|
where: { idSeccion }
|
|
}).then(res => {
|
|
if(!res) throw new Error("No hay ninguna pregunta con este idSeccion.")
|
|
return res;
|
|
});
|
|
};
|
|
|
|
module.exports = traerPoridSeccion;
|