get para eventos

This commit is contained in:
2021-04-03 11:41:38 +02:00
parent b111aa6282
commit 207b7461b0
2 changed files with 26 additions and 3 deletions

View File

@@ -72,7 +72,22 @@ async function addEvento(evento){
module.exports.addEvento = addEvento;
async function getEventos(discotecaId){
async function getEventos(){
try{
let conn = await mariadb.getConn();
const rows = await conn.query("SELECT id, discotecaID, nombre, localizacion, fecha, hora, descripcion, precio1, precio2 FROM evento");
conn.release();
if(rows){
return rows;}
}catch(err){
console.log("No se pudo acceder a la BD: "+err);
}
}
module.exports.getEventos = getEventos;
async function getEventosDiscoteca(discotecaId){
try{
let conn = await mariadb.getConn();
const rows = await conn.query("SELECT id, discotecaID, nombre, localizacion, fecha, hora, descripcion, precio1, precio2 FROM evento WHERE discotecaID = ?", [discotecaId.id]);
@@ -86,4 +101,4 @@ async function getEventos(discotecaId){
}
}
module.exports.getEventos = getEventos;
module.exports.getEventosDiscoteca = getEventosDiscoteca;